[TYPO3-english] DB Select

Ries van Twisk typo3 at rvt.dds.nl
Mon Oct 5 19:00:35 CEST 2009


On Oct 5, 2009, at 11:44 AM, Jan Bednarik wrote:

> 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)

You cannot talk about that in the TYPO3 list!!!! (just kidding..)


>
>> 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$'

RLIKE is not a SQL standard... just so you know....

>
> Regards
>
> -- 
> Jan Bednarik
> www.bednarik.org - web about Typo3 in czech
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english


			regards, Ries van Twisk

- Join us on #TYPO3 on freenode | irc://chat.freenode.net/#typo3

-------------------------------------------------------------------------------------------------
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS  
WebORB PostgreSQL DB-Architect
email: ries at vantwisk.nl        web:   http://www.rvantwisk.nl/     
skype: callto://r.vantwisk








More information about the TYPO3-english mailing list