[TYPO3-english] DB Select
Jan Bednarik
info at bednarik.org
Mon Oct 5 18:44:37 CEST 2009
Hi,
> Example Table 2
> uid;name;category
> 1;name1;1,2
> 2;name2;2
> 3;name3;1,2,3
this is wrong databse design, that violates even the first normal form
(see http://en.wikipedia.org/wiki/Database_normalization)
> 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.
There is no command for it. Try to construct plain SQL query that would
do the job. If you can, then you can put parts of the query into
exec_SELECTquery.
I can think of 1 way to do that, but it's really really ugly.
SELECT * FROM table2 WHERE category LIKE '%,X,%' OR category RLIKE '^X,'
OR category RLIKE ',X$'
Regards
--
Jan Bednarik
www.bednarik.org - web about Typo3 in czech
More information about the TYPO3-english
mailing list