Thursday, March 29, 2012

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.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.

No comments:

Post a Comment