SQL and Pivot tables, rows to columns

See:
http://modern-sql.com/use-case/pivot
How to map table rows to columns using SQL PIVOT or CASE expressions

Postgresql:
https://www.postgresql.org/docs/current/static/tablefunc.html

https://stackoverflow.com/questions/3002499/postgresql-crosstab-query/11751905#11751905

Oracle:
http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html

SQL server:
https://msdn.microsoft.com/en-us/library/ms177410.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s