[TYPO3-dev] sql order by with left join

Bas van der Togt bas.vander.togt at efocus.nl
Mon Nov 5 16:02:13 CET 2007


I don't get any error but the sorting is not working.
If i set ORDER BY alsosee.sorting it's working but that's not what i 
want, i want to sort it based on the mm table so ORDER BY mm.sorting but 
that's not working. Any idea?

Malte Jansen wrote:
> Hi Bas!
> 
> Try your SQL-Query in PHPmyAdmin and check the errors...
> 
> Malte
> 
> Bas van der Togt schrieb:
>> Hello list,
>>
>> I'm trying to order a list in my extension but i can't get it work.
>> The sql has a 'left join' and that must me the problem i think. Does 
>> anybody knows how to order my sql with a left join?
>>
>> SQL:
>> SELECT alsosee.*, cat.*, mm.*, alsosee.uid AS alsoseeuid
>> FROM tx_profalsosee_cat_mm AS mm
>> LEFT JOIN tx_profalsosee_cat AS cat ON mm.uid_foreign=cat.uid
>> LEFT JOIN tx_profalsosee_alsosee AS alsosee ON mm.uid_local=cat.uid
>> WHERE alsosee.hidden=0 AND alsosee.deleted=0 AND alsosee.t3ver_state=0 
>> AND alsosee.pid IN ('.$pidList.')
>> ORDER BY mm.sorting
>>
>> Kind regards,
>> Bas




More information about the TYPO3-dev mailing list