Top "Pivot" questions

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

Construct pandas DataFrame from list of tuples of (row,col,values)

I have a list of tuples like data = [ ('r1', 'c1', avg11, stdev11), ('r1', 'c2', avg12, stdev12), (…

python python-2.7 pandas pivot
Pivoting rows into columns dynamically in Oracle

I have the following Oracle 10g table called _kv: select * from _kv ID K V ---- ----- ----- 1 name Bob 1 …

sql oracle oracle10g pivot
How to convert Rows to Columns in Oracle?

I have a table in this form (this is just the partial view, the table contains more than 100 columns). LOAN …

sql oracle pivot
TSQL PIVOT MULTIPLE COLUMNS

I have the following table but unsure of whether it is possible to pivot this and retain all the labels. …

sql sql-server tsql pivot
MySQL - sum column value(s) based on row from the same table

I'm trying to get 'Cash', 'Check' and 'Credit Card' totals in new columns based on ProductID from the same table. …

mysql select group-by left-join pivot
How to replace (null) values with 0 output in PIVOT

I tried to convert the (null) values with 0 (zeros) output in PIVOT function but have no sucess. Below is the …

sql sql-server pivot
SQL Server Pivot Table with multiple column aggregates

I've got a table: create table mytransactions(country varchar(30), totalcount int, numericmonth int, chardate char(20), totalamount money) The table has …

sql-server sql-server-2005 pivot unpivot
MySQL pivot table query with dynamic columns

I'm using the following tables for storing product data: mysql> SELECT * FROM product; +---------------+---------------+--------+ | id | name | description | …

mysql dynamic pivot
Laravel, sync() - how to sync an array and also pass additional pivot fields?

Official Laravel documentation has this on sync() function: $user->roles()->sync( array( 1, 2, 3 ) ); You may also associate other …

php laravel pivot eloquent sync
MySQL pivot row into dynamic number of columns

Lets say I have three different MySQL tables: Table products: id | name 1 Product A 2 Product B Table partners: id | name 1 …

mysql sql pivot