sql server 2008 - TSQL: Join columns, but rows in one column have multiple values -
i have query have join 2 tables. lets t1 , t2. t1 has column id. , every row has 1 id value. however, second table i'm struggling. in t2 there column id's can possible 1 row has multiple of id's. example t1.col1 has value: 737382. t2.col2 can have entries in 1 row: 737382;239112;2838210;9923834;2388342;...
i know structure violates 1nf , stuff. cannot change in data or structure of data. want join 2 tables. please let me know if i'm missing tell relevant information in order answer question. late , brain exhausted ~.~
try
select tab2.* -- whatever t1 tab1 inner join t2 tab2 on ( ';'||tab2.col2||';' '%;'||tab1.col1||';%' ) ; the affixed ; characters serve avoid disjunctions in join condition.
Comments
Post a Comment