Page 1 of 1

selecting when not in array

Posted: Thu Mar 27, 2003 2:04 am
by ckuipers
I need a bit of help on this. I'm trying to get mysql to select something when a value is not part of a list:

Code: Select all

SELECT DISTINCT project FROM pos LEFT JOIN region_lookup ON pos.country_id= region_lookup.country_id WHERE project <> '301' AND project <> '302' AND project <> '330' AND status <> 'canceled' AND region_lookup.region_id= '$Region' ORDER BY project
Now that I'm upgrading the database, this list of projects gets longer. Is there a way to have it combined in an array?

Thx

Posted: Thu Mar 27, 2003 2:25 am
by ckuipers
Found it:

Code: Select all

MySQLQuery("SELECT DISTINCT project FROM pos LEFT JOIN region_lookup ON pos.country_id= region_lookup.country_id WHERE project NOT IN (301, 302, 330) AND status <> 'canceled' AND region_lookup.region_id= '$Region' ORDER BY project