Table 1:
A B C
Test 1 This
Test1 1;4 That
Test2 7 What
Test3 6;2 Which
Test4 1;2;7 Where
Table 2:
X Z
1 Sun
2 Mon
3 Tue
4 Wed
5 Thu
6 Fri
7 Sat
Sql:
Select
t1.A,
t2.Z
from
[dbo].[Table 1] t1
inner join [dbo].[Table2] t2
on t1.B = t2.X
It works only for the rows that has only 1 entry in B
column but fails at the 2 or more entries.
How can I modify the Sql so that it gives me the result like this:
A Z
Test Sun
Test1 Sun;Wed
Test2 Sat
Test3 Fri;Mon
Test4 Sun;Mon;Sat