Page 1 of 1

using the WHERE IN Clause

Posted: Tue 31 Jul 2007 10:54
Hi,

Is it possible to use a MySqlParameter like so:

select * from table where key IN (:list)

and list is a string of codes?

i've tried with 'Code1','Code2','Code3' and also Code1,Code2,Code3 but neither are producing any results.

So is the WHERE IN Clause supported? I've not found it anywhere in the documentation or forums so far?

many thanks
paul

Posted: Tue 31 Jul 2007 11:38
by Alexey
No, this is not supported, unfortunately.

Posted: Tue 31 Jul 2007 14:00
Okay, so if i wanted to get a list of specific records what is the most effecient way of doing this?

code = 'Code1' OR code = 'Code2' OR code="Code3'....?

Or is there a more suitable SQL construct?

thanks in advance
paul

Posted: Tue 31 Jul 2007 21:53
by NorthOfTheCity
Trust me, a list for an IN clause can't be transfered to a query via parameter. MS stuff won't do it either. You have to build the query as a string in code for it to work.

Posted: Wed 01 Aug 2007 06:29
by Alexey
[email protected] wrote:Okay, so if i wanted to get a list of specific records what is the most effecient way of doing this?
code = 'Code1' OR code = 'Code2' OR code="Code3'....?
Or is there a more suitable SQL construct?
I think this SQL construct is suitable enough.