Hi,
I use SQL server Management studio,
In Table1 we have Name and Dept column, if the person is in more than one dept then assign then as result shown below.
Is this possible to do it using case statement
Table1
Name | Dept |
A | Finances |
A | Sales |
B | Finances |
B | Sales |
B | Billing |
C | Finances |
D | Sales |
Result:
Name | Dept | Dept_Group |
A | Finances | F/S |
A | Sales | F/S |
B | Finances | F/S/B |
B | Sales | F/S/B |
B | Billing | F/S/B |
C | Finances | F |
D | Sales | S |