[Typo3-dev] database relations in TYPO3

Ries van Twisk typo3 at rvt.dds.nl
Wed Nov 16 18:12:49 CET 2005


Dmitry Dulepov wrote:

>Hi!
>
>Dmitry Dulepov wrote:
>  
>
>>I do not see a problem. For example, why you can do this:
>>	select * from sys_filemounts where uid in
>>		(select file_mountpoints from be_user
>>			where username='admin')
>>    
>>
If file_mountpoints is a comma seperated list of numbers then the above 
SQL (as you discovered) will not work as expected.

If one file_mountpoints field in be_users holds a value like '23,2'
then the abive SQL trys to find a related field in  iod with teh same value.
and since uid is a simple integer the above SQL will never return records
for sys_filemounts where the uid = 23 and uid=2.

There is a function in typo3 that generates a nice IN statement in a 
where clause.
to return the right records in your next statement.

Ries




More information about the TYPO3-dev mailing list