[TYPO3-english] QueryResultInterface for latest tt_content images

Sergio Catalá scatala.enet at gmail.com
Mon Jul 14 17:24:53 CEST 2014


Hi Mark,

Well, I don't wanna do a JOIN for now, as I am interested first in the 
"uid"s of the tt_content elements. Later, I can just get the field 
"image" and iterate through the file references.

The problem I see with the GROUP BY / HAVING clauses is that I can't 
find any function that manages this inside the repository class. Just 
this "raw sql" statement() function.

Another solution is like you said, to use a Typoscript object, but I 
would like to avoid this.

Regards,
Sergio

On 14/07/14 11:12, Mark Boland wrote:
> Hi Sergio,
>
> there is no problem with GROUP BY / HAVING clauses in TYPO3, is there? And
> you don¹t need the subquery as far as I can see. You can do a JOIN with
> the FAL tables for textpic CEs.
>
> Cheers
>
> Mark
>
> Am 14.07.14 10:43 schrieb "Sergio Catalá" unter <scatala.enet at gmail.com>:
>
>> Hi Mark,
>>
>> Thanks for your answer.
>> I need a GROUP BY and HAVING, because I want to get the first image for
>> the latest created tt_content element (normally an Image element with
>> several images) but from certain pids. And I don't want to display two
>> latest tt_content elements from the same pid, just the latest tt_content
>> of every pid.
>>
>> Regards,
>> Sergio
>>
>>
>> On 13/07/14 16:42, Mark Boland wrote:
>>> 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
>>> _______________________________________________
>>> TYPO3-english mailing list
>>> TYPO3-english at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>
> _______________________________________________
> 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