Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: JayRoe - heinäkuu 03, 2008, 05:42:13 IP

Otsikko: Mysql query question
Kirjoitti: JayRoe - heinäkuu 03, 2008, 05:42:13 IP
Is it possible to do something like this:
SELECT * FROM releases WHERE labels NOT INTERSECT $exludeList

The labels fields are strings with four integers. Ie. "1, 34, 73, 66"

Thanks for reading.  :)
Otsikko: Re: Mysql query question
Kirjoitti: Tony Reid - heinäkuu 03, 2008, 05:51:19 IP
I think you need "not in" rather than intersect

SELECT * FROM releases WHERE labels NOT IN ('1', '34','73','66');

Otsikko: Re: Mysql query question
Kirjoitti: JayRoe - heinäkuu 03, 2008, 06:08:22 IP
Thanks for the swift reply. Won't that return a false if the label is "1,3,6" and the exclude list is "1,2,3,4,8,9"?
I mean in this example the string "1,3,6" is not to be found in the exclude list.