[TYPO3-mvc] How to create join query with group by in extbase

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jun 23 17:00:48 CEST 2010


Hey,

> My query is as follow
>
> "SELECT first_table.*,count(second_table.uid) as issuecount FROM
> first_table JOIN second_table ON first_table.uid = second_table.pid
> GROUP BY second_table.pid "
>
> I tried running this query with
>
> $query->statement("SELECT first_table.*,count(second_table.uid) as
> issuecount FROM first_table JOIN second_table ON first_table.uid =
> second_table.pid GROUP BY second_table.pid")->execute;
>
> the query is running fine but it doesnot return the value of "
> count(second_table.uid) as issuecount " in the object
>
> So does any body know how to write the join query with group by in
> extbase style .

unfortunately there is no extbase style for that AFAIK. You could try to 
add a fake TCA entry for the imaginary "issuecount" column - maybe that 
helps. If not, you can tell the query object to return the raw result 
rows which you can map on objects by your own then. I don't know of any 
other solution.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list