Top "Pivot" questions

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

Using pivot on multiple columns of an Oracle row

I have the following sample data in an Oracle table (tab1) and I am trying to convert rows to columns. …

sql oracle oracle11g pivot
Mysql Convert Column to row (Pivot table )

I have a table like this +---+-----+----+----+----+----+ |id |month|col1|col2|col3|col4| +---+-----+…

mysql sql pivot unpivot
Oracle SQL Developer: How to transpose rows to columns using PIVOT function

I'm attempting to create a query to transpose rows into columns using the PIVOT function. This is the contact table …

sql oracle pivot oracle9i
How to pivot Spark DataFrame?

I am starting to use Spark DataFrames and I need to be able to pivot the data to create multiple …

scala apache-spark dataframe apache-spark-sql pivot
SQL transpose full table

I need to do the following transpose in MS SQL from: Day A B --------- Mon 1 2 Tue 3 4 Wed 5 6 Thu 7 8 Fri 9 0 …

sql sql-server pivot unpivot
Dynamically create columns sql

I have a table of Customers Customer ID Name 1 John 2 Lewis 3 Mary I have another table CustomerRewards TypeID Description 1 Bronze 2 …

sql sql-server tsql pivot dynamic-pivot
How to transpose mysql table rows into columns

Here is what my current mysql table looks like: PunchID EmpID PunchEvent PunchDateTime 1 0456 clockin 5/14/2013 8:36:26 AM 48 0456 breakout 5/14/2013 12:01:29 PM 53 0456 breakin 5/14/2013 12:28:31 PM 54 0456 clockout 5/14/2013 2:28:33 …

mysql sql pivot
How to pivot rows into columns (custom pivoting)

I have a Sql Database table similar to the following: Day Period Subject Mon 1 Ch Mon 2 Ph Mon 3 Mth Mon 4 …

sql tsql pivot
SQL Group By - counting records per month/year, error on insert - NOT A VALID MONTH

I have this example data: Country | Members | Joined USA | 250 | 1/1/2012 USA | 100 | 1/8/2012 Russia | 75 | 1/20/2012 USA | 150 | 2/10/2012 When I query this data I would like …

sql oracle group-by pivot
Is it possible to have multiple pivots using the same pivot column using SQL Server

I am facing the following challenge. I need to rotate table data twice over the same column. Here's a screenshot …

sql sql-server pivot unpivot