Sql query

How to convert rows to columns in sql

Google the Pivot command, which exists for this purpose.