I believe MS SQL Server supports pivots tables, but I'm not sure exactly how to do them. When I have to pivot data in MySQL, I use Sum and Case. However, that only works when you know what your column names are going to be in advance. Here's how I might do it:
Select X.ClassName, X.Description, Case When X.F1 = 1 Then 'T' Else 'F' End As `F1`, Case When X.F2 = 1 Then 'T' Else 'F' End As `F2` /* etc. for the rest of your Flags*/ FROM ( Select ClassName, Description, Sum(Case When Flags = 'F1' Then 1 Else 0 End) As `F1`, Sum(Case When Flags = 'F2' Then 1 Else 0 End) As `F2` /* etc. for the rest of your Flags*/ From ClassTable Group By ClassTable.ClassName ) X
In the above code, the subquery will produce output like what you wanted, except that you'll get 1's and 0's (assuming you never repeat a flag for a class). The "main" query at the top of the statement simply turns the 1's and 0's into T's and F's.
Again, this requires you to know what your column names will be, but it's the only way I know how to do it without "PIVOT" being built in to the SQL language you are using. MS SQL might have a PIVOT built-in, so you might want to dig to find that.