Top "Pivot" questions

The PIVOT syntax converts row data into columnar data, and vice versa for the UNPIVOT syntax.

Efficiently convert rows to columns in sql server

I'm looking for an efficient way to convert rows to columns in SQL server, I heard that PIVOT is not …

sql sql-server sql-server-2008 pivot
Convert Rows to columns using 'Pivot' in SQL Server

I have read the stuff on MS pivot tables and I am still having problems getting this correct. I have …

sql sql-server pivot pivot-table
Simple way to transpose columns and rows in SQL?

How do I simply switch columns with rows in SQL? Is there any simple command to transpose? ie turn this …

sql sql-server tsql pivot
How can I combine multiple rows into a comma-delimited list in Oracle?

I have a simple query: select * from countries with the following results: country_name ------------ Albania Andorra Antigua ..... I would …

sql oracle concatenation pivot string-aggregation
How can I return pivot table output in MySQL?

If I have a MySQL table looking something like this: company_name action pagecount ------------------------------- Company A PRINT 3 Company A …

mysql sql pivot
SQL Server dynamic PIVOT query?

I've been tasked with coming up with a means of translating the following data: date category amount 1/1/2012 ABC 1000.00 2/1/2012 DEF 500.00 2/1/2012 GHI 800.00 2/10/2012 …

sql sql-server tsql pivot
PostgreSQL Crosstab Query

Does any one know how to create crosstab queries in PostgreSQL? For example I have the following table: Section Status …

sql postgresql pivot case crosstab
Understanding PIVOT function in T-SQL

I am very new to SQL. I have a table like this: ID | TeamID | UserID | ElementID | PhaseID | Effort ----------------------------------------------------- 1 | 1 | 1 | 3 | 5 | 6.74 2 | 1 | 1 | 3 | 6 | 8.25 3 | 1 | 1 | 4 | 1 | 2.23 4 | 1 | 1 | 4 | 5 | 6.8 5 | 1 | 1 | 4 | 6 | 1.5 And …

sql-server sql-server-2008 tsql pivot
TSQL Pivot without aggregate function

I have a table like this... CustomerID DBColumnName Data -------------------------------------- 1 FirstName Joe 1 MiddleName S 1 LastName Smith 1 Date 12/12/2009 2 FirstName Sam 2 MiddleName …

sql sql-server tsql pivot pivot-without-aggregate
SQL Server: Examples of PIVOTing String data

Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or …

sql-server tsql pivot