Page 1 of 1

select query with multiple parameters

Posted: Thu Aug 17, 2006 8:32 am
by taldos
what I want to accomplish:

Rather then running a query that resembles this:

Code: Select all

SELECT * FROM table1 WHERE (id LIKE 1 || id LIKE 2 || id LIKE 3 || id LIKE 4 || id LIKE 5) || (name LIKE a || name LIKE b || name LIKE c || name LIKE d)
Rather then running such a cumbersome query, is it possible to pass a comma delimited string as follow.

Code: Select all

SELECT * FROM table1 WHERE id LIKE (1,2,3,4,5) || name LIKE (a,b,c,d)
The syntax is giving me some trouble. Any hints help would be appreciated.

Thx.

Posted: Thu Aug 17, 2006 8:33 am
by JayBird

Code: Select all

SELECT * FROM `table1` WHERE `id` IN (1,2,3,4,5) OR `name` IN (a,b,c,d)
maybe something like that?

Posted: Thu Aug 17, 2006 8:34 am
by feyd
I don't remember pipes being supported, should probably switch those to "OR"

Posted: Thu Aug 17, 2006 8:56 am
by taldos
that should do it. thx. :)