How to transform vertical data into horizontal data with SQL?
Regardless of the database you are using, the concept of what you are trying to achieve is called “Pivot Table”. Here’s an example for mysql: http://en.wikibooks.org/wiki/MySQL/Pivot_table Some databases have builtin features for that, see the links below. SQLServer: http://msdn.microsoft.com/de-de/library/ms177410.aspx Oracle: http://www.dba-oracle.com/t_pivot_examples.htm You can always create a pivot by hand. Just select all the aggregations in … Read more