I have a table table1 like this:
sl next day count status
--------------------------
A 1 1 1 Yes
A 1 1 2 Yes
A 1 1 3 Yes
A 1 1 4 Yes
A 1 2 1 Yes
A 1 2 2 No
A 1 2 3 Yes
A 1 2 4 Yes
A 2 1 1 Yes
A 2 1 2 Yes
A 2 1 3 Yes
A 2 1 4 Yes
and output should be like:
sl next status daylist
------------------------------
A 1 Yes 1-All
2-1,3,4
A 1 No 2-2
A 2 Yes 1-All
As you seen the output, daylist is the combination of count and day which are grouped by status per next level.
Can anyone help me achieve this in T-SQL?
Thanks in advance!