| Author |
Topic  |
|
|
12many
Starting Member
9 Posts |
Posted - 03/08/2013 : 12:46:23
|
Hi there
I have a field in table one that is a delimited list of codes(a,b,c,d) that relate to data in table 2
I have created a @VAR in in my report that reads
DECLARE @VAR VARCHAR(50) SET @VAR '''' + REPLACE((SELECT fields FROM table1),',',''',''') + ''''
So the Value in @Var will read 'a','b','c','d'
What i was then hoping to be able to do is
SELECT Data FROM Table2 WHERE Code IN (@VAR)
It has come to my attention this is not possible
Can any one give any advise on how this can be achieved
Ian |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47099 Posts |
|
|
12many
Starting Member
9 Posts |
Posted - 03/14/2013 : 06:46:59
|
Hi visakh16
Thanks Alot for this, Ill give it a bash when i get a chance,
Ian |
 |
|
|
LoztInSpace
Aged Yak Warrior
876 Posts |
Posted - 03/14/2013 : 09:28:29
|
why not just store the values in table1 properly (i.e. 1 per row) then simply use SELECT Data FROM Table2 WHERE Code IN (select field from table1) ? |
 |
|
| |
Topic  |
|