[TYPO3-english] DB Select

JoH asenau info at cybercraft.de
Mon Oct 5 17:21:05 CEST 2009


> I'm writing an extension. Now I have a table with uid and name of
> category and another table with a field that reference to the first
> table.
>
> Example Table 1;
> uid;name
> 1;category1
> 2;category2
> 3;category3
>
> Example Table 2
> uid;name;category
> 1;name1;1,2
> 2;name2;2
> 3;name3;1,2,3
>
> I need, for example, all the record of second table with category 1.
> What is the command to use? I try with  exec_SELECTquery, but I don't
> find how set the parameters.

You should get rid of CSV and go for real MM relations instead.

Execution of queries will be much faster, because you can use JOIN and ON
instead of LIKE and/or CONCAT or a regular expression to find the records
belonging to one or more categories.

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com
TYPO3 workshops: http://workshops.eqony.com




More information about the TYPO3-english mailing list