Group By

Login or register to post comments
2 replies [Last post]
Offline
Joined: 06/21/2010

I have something like this

$myRez = Rule::QueryArray(
QQ::All(),
QQ::Clause(
QQ::GroupBy(QQN::Rule()->Id
)
)
);

I belive the result query is something like this

Select field1,field2 from Table1 group by field1

How can I limit the selected fields ? So I have something like
Select field1 from Table1 group by field1

Offline
Joined: 03/31/2008

Unfortunately the framework does not currently support this. We have a preliminary patch and some discussion in http://trac.qcu.be/projects/qcubed/ticket/79 but I can't guarantee it's the most efficient approach, or the one we will eventually incorporate.

vakopian's picture
Offline
Joined: 04/08/2008

Danip, see also the last comments in http://trac.qcu.be/projects/qcubed/ticket/270 . There is code there that may help you suppress the automatically added fields, and to add the aggregation fields that you need. I'm currently using that to solve the exact problem you're facing.