using the WHERE IN Clause

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
paul@paulcurtis.org
Posts: 2
Joined: Tue 31 Jul 2007 10:50

using the WHERE IN Clause

Post by paul@paulcurtis.org » 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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 31 Jul 2007 11:38

No, this is not supported, unfortunately.

paul@paulcurtis.org
Posts: 2
Joined: Tue 31 Jul 2007 10:50

Post by paul@paulcurtis.org » 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

NorthOfTheCity
Posts: 4
Joined: Sun 03 Jun 2007 01:57

Post by NorthOfTheCity » Tue 31 Jul 2007 21:53

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.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 01 Aug 2007 06:29

paul@paulcurtis.org 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.

Post Reply