using the WHERE IN Clause

using the WHERE IN Clause

Postby 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
paul@paulcurtis.org
 
Posts: 2
Joined: Tue 31 Jul 2007 10:50

Postby Alexey » Tue 31 Jul 2007 11:38

No, this is not supported, unfortunately.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby 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
paul@paulcurtis.org
 
Posts: 2
Joined: Tue 31 Jul 2007 10:50

Postby 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.
NorthOfTheCity
 
Posts: 4
Joined: Sun 03 Jun 2007 01:57

Postby 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.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL