Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
alecwh22
Starting Member
15 Posts |
Posted - 2011-12-02 : 08:36:05
|
| I have a statement select top 1 tabl1_col1 from table1/*resultcol1----------------------------('thing1','thing2','thing3')*/and I want to do select col1_table2from table2where col2_table2 in (select top 1 tabl1_col1 from table1)but its doesn't work :'(my plan to solve it is to take the list and put it into a column ina temp table but can't think how to do it. can anyone think of a wayor an alternative? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-02 : 09:25:52
|
shouldnt it beselect col1_table2from table2where ',' + (select top 1 tabl1_col1 from table1) + ',' like '%,' + col2_table2 + ',%' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-12-02 : 09:34:51
|
| I'm guessing that the quote delimitters are there for a reasonwhere (select top 1 replace(replace(tabl1_col1,'(',','''),'(',''',') from table1) like '%,''' + col2_table2 + ''',%'==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|