[TYPO3-core] RFC: Fix for bug #1649

Holzinger Franz franz at fholzinger.com
Thu Dec 22 15:38:54 CET 2005


Hello Karsten,

> With 
>the change code the WHERE part stays the same, and afterwards the 
>$foreign_table is unset, leading to a query like this:
> SELECT * FROM tx_something,tx_something_mm WHERE
>   tx_something.uid=tx_something_mm.uid_local AND
>   tx_something.uid=tx_something_mm.uid_foreign
>
>  
>
>>Anyway, if you have a self-referecingn relation you still have to have a
>>"2nd" table. So that the statemen mentioned above makes sense. But you have
>>to use SQL aliases.
>>    
>>
>
>The tx_something is there, without duplicate. No need for an alias. It could 
>be used, but then you would run into the risk of using an alias that indeed 
>already exists in the DB. Humpf. This way has no associated risk.
>
>  
>

But there is a big difference if you use 2 aliases for the same table or 
not. And I have tested this out.

 SELECT * FROM tx_something,tx_something_mm WHERE
   tx_something.uid=tx_something_mm.uid_local AND
   tx_something.uid=tx_something_mm.uid_foreign

Nothing has been found here.

SELECT *
FROM 

tx_something A, tx_something_mm MM, tx_something B

WHERE A.uid = MM.uid_local
AND B.uid = MM.uid_foreign

which gives a list of records where the fields of tx_something are 
listed twice, one for the first uid and one for the second uid.



Regards,

Franz









More information about the TYPO3-team-core mailing list