If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > field in a table that stores my IN condition (was "In")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-05, 09:51
mkkmg mkkmg is offline
Registered User
 
Join Date: Oct 2003
Location: Dallas
Posts: 76
field in a table that stores my IN condition (was "In")

Hello,

Alright here is the issue. I have a field in a table that stores my IN condition.

S0 I have a field that contains data like this: 'a','b','c'

basically I now just want that to be my IN clause....any ideas???

I tried something like this
declare @in as varchar(10)
set @in = (select field from table)

select * from table
where field in (@in)

of course that does not work...and many variations of that also.

Let me know if you can lead me down the right path on this.
Reply With Quote
  #2 (permalink)  
Old 01-26-05, 11:08
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
You may consider modifying your design to store 'a', 'b', 'c' as separate rows in your table instead of a string of possible values. That makes the SQL easier and you can do things like joins instead of the IN clause.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On