SQL Pivot Help: I have three tables as follows: Class Table:
ID Name
1 N1
2 N2
3 N3
Flags Table:
ID ClassID Flags
1 1 F1
1 1 F2
1 2 F3
1 3 F1
1 3 F3
Session Table:
ID ClassID Session
1 1 S1
2 1 S2
3 1 S3
4 2 S2
5 2 S5
6 3 S1
6 3 S2
Now I need to create a view something like this:
Class View:
ID Name Flags Session
1 N1 F1,F2 S1,S2,S3
2 N2 F3 S2,S5
3 N3 F1,F3 S1,S2