I have a table with a column of comma separated values, i want to take them as different values and place inside The In clause of another select statement. i've tried with cross apply but didn't get it working properly
the table (T1) looks like :
Empcode Eid Unitcodes
007645 164 UNT111$UNT112$UNT113$
000645 162 UNT100$UNT102$UNT20$UNT97$UNT98$UNT99$UNT136$
002585 163 UNT25$UNT39$
003059 180 UNT76$
000559 165 UNT109$UNT114$UNT166$UNT27$UNT60$UNT103$UNT58$
003049 175 UNT106$UNT54$UNT86$UNT87$UNT130$UNT131$UNT132$
003049 177 UNT51$UNT56$UNT91$UNT92$
and i need a query something like :
select * from T2 where empcode='abcd' unitcode in ('UNT111','UNT112','UNT113')
//only that particular emps Unitcodes from the table T1