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 |
|
chrianth
Yak Posting Veteran
50 Posts |
Posted - 2011-03-15 : 11:10:15
|
| Hi All,Need help on the logic to search a value of a specific column to a column that have concatenated value.Given the following setup for my table.Table_A:Column1 Column21 ABC2 DEF3 MNOTable_B:Column1 Column2Track_01 ABC,DEF,GHITrack_02 JKL,MNOGiven the table data sample on each table above, I need a query that will give me the track number of each record on Table A. The output should look like the table below.Table_A.Column1 Table_A.Column2 Table_B.Column11 ABC Track_012 DEF Track_013 MNO Track_02Can someone please help me how to deal with this. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-03-15 : 11:42:06
|
| select a.column1,a.column2,b.column1from table_a across join table_b bwhere b.column2 like '%' + a.column2+'%'JimEveryday I learn something that somebody else already knew |
 |
|
|
chrianth
Yak Posting Veteran
50 Posts |
Posted - 2011-03-16 : 05:17:51
|
That was nice Jim, it works fine. Thanks.quote: Originally posted by jimf select a.column1,a.column2,b.column1from table_a across join table_b bwhere b.column2 like '%' + a.column2+'%'JimEveryday I learn something that somebody else already knew
c-bass |
 |
|
|
|
|
|