Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

select distinct
 
Notifications
Clear all

select distinct

3 Posts
2 Users
0 Reactions
3,163 Views
(@lu611)
Posts: 30
Active Member
Topic starter
 
[#2120]

Hy,

I need to a private report to extract a list of table records 'work' for a given week.
I use the following script:

$where='idProject in '. $projectList;
$where.=' and idResource = '. $user->id;
$where.=' and week = '. $periodValue;
$work = new Work();
$workList = $work->getSqlElementsFromCriteria(null, false, $where);
foreach ($workList as $work) { ...

The result is a list containing one row per day, like this sql command :

select * from work where idProject = ............

But my need is :

select distinct (field 1, filed 2, .. ) from work where idProject = ......

How can I do ?

Thanks in advance.

Armel


 
Posted : 28 Nov 2014 17H52
(@babynus)
Posts: 14952
Member Admin
 

What you need is a "group by" query.
ProjeQtOr persistence framework does not take these queries into account.
You have to build it by your own and use the Sql::query() to execute it.


 
Posted : 28 Nov 2014 18H17
(@lu611)
Posts: 30
Active Member
Topic starter
 

Thanks,

I've find an other issu : i just transform my "$workList" with php function array_unique .

It's running.

You can close the topics.


 
Posted : 28 Nov 2014 20H25
Share:

Scroll to Top