Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: IN Clause


Message #1 by Ludwig Brandon-FBL017C <Brandon.Ludwig@m...> on Fri, 14 Sep 2001 11:53:33 -0400
Thanks Imar. I ended up re-writing the clause to use OR's instead of the IN.
There's usually 50+ values in there, so I had preferred to use the IN, but
needed the wildcard. Thanks for the push in the right direction!

Brandon Ludwig
Brandon.Ludwig@M...


 -----Original Message-----
From: 	Imar Spaanjaars [mailto:Imar@S...] 
Sent:	Friday, September 14, 2001 12:00 PM
To:	sql language
Subject:	[sql_language] Re: IN Clause

Hi Brandon,

No, I don't think so. AFAIK, the IN clause values should match exactly with 
the "field" value.

Your second example is already using a wildcard. That code just works as 
you would expect it to, so I don't see a reason to specify a wildcard in 
the IN clause.

To get the same result as an IN clause, you could also specify multiple 
WHERE clauses, like this:

   SELECT * FROM table WHERE field LIKE 'value1' or field LIKE 'value2'

You can also combine that with a wildcard like this:

   SELECT * FROM table WHERE field LIKE 'value1' or field LIKE 'val%'

Hope this helps,

Imar





At 11:53 AM 9/14/2001 -0400, you wrote:
>I have a statement with an IN clause in it:
>
>SELECT * FROM table WHERE field IN ('value1', 'value2')
>
>Is it possible to have wildcards in the IN clause? Like:
>
>SELECT * FROM table WHERE field LIKE 'value%'
>
>Thanks!
>
>Brandon Ludwig
>Brandon.Ludwig@M...
>
>

  Return to Index