[TYPO3-english] QueryResultInterface for latest tt_content images

Mark Boland mark.boland at boland.de
Sun Jul 13 16:42:11 CEST 2014


Hi Sergio

Why using GROUP BY and HAVING? WHERE should be enough and don't forget to use deleted = 0 AND hidden = 0 to exclude hidden or deleted records.

You could achieve this with a pure Typoscript .select in a CONTENT element.

Cheers
Mark

> Am 13.07.2014 um 14:33 schrieb Sergio Catalá <scatala.enet at gmail.com>:
> 
> Hi list,
> 
> I've built a new extension that maps tt_content table. I would like to get the images from the latest created tt_content elements.
> 
> I would like to transform this SQL sentence:
> 
>    SELECT tt_content.image
>    FROM (SELECT * FROM tt_content ORDER BY tt_content.crdate DESC) tt_content
>    GROUP BY tt_content.pid, tt_content.sys_language_uid
>    HAVING tt_content.pid in (2,3,4,5) AND tt_content.sys_language_uid = 0
>    LIMIT 0,4
> 
> into a QueryResultInterface for my content repository.
> 
> But I am not sure if I can use GROUP and HAVING clausules with existing functions for the $query.
> I saw I can use a "raw sql" through statement() function, but I don't want to use that.
> 
> Is this possible?
> 
> Thanks in advance,
> Sergio
> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english


More information about the TYPO3-english mailing list