unpivot Questions

6

Solved

I need to convert the Excel matrix FIRST in the table LATER: FIRST: P1 P2 P3 P4 F1 X F2 X X F3 X X F4 X X LATER: F P VALUE F1 P1 X F1 P2 F1 P3 F1 P4 F2 P1 X F2 P2 X F2 P3 F2 P4 F3 P1 F3 P2 X...
Busily asked 12/12, 2013 at 11:11

5

Solved

I am facing the following challenge. I need to rotate table data twice over the same column. Here's a screenshot of the data. I want to have one row for each Item ID containing both the purchasi...
Nadbus asked 7/3, 2013 at 14:53

12

I am trying to produce a "reverse pivot" function. I have searched long and hard for such a function, but cannot find one that is already out there. I have a summary table with anywhere u...

4

I have a table like this id month col1 col2 col3 col4 101 Jan A B NULL B 102 feb C A G E And then I want to create report like this desc jan feb col1 A C col2 B A col3 0 G...
Untruthful asked 19/12, 2012 at 1:49

2

Solved

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 To the following: Value Mon Tue Wed Thu Fri -------------------------- A 1 3 5 ...
Two asked 8/3, 2013 at 15:44

2

Solved

I have table with the following information: CREATE TABLE [dbo].[ApprovedPalmsInFarm]( [id] [int] IDENTITY(1,1) NOT NULL, [FarmID] [nvarchar](10) NOT NULL, [kalas] [int] NULL, [khnizi] [int] NU...
Annabell asked 6/5, 2015 at 21:57

1

Solved

How do I transpose and transform this table: Receipt date Amount Child 1 Shirt size Age Child 2 Shirt size Age Child 3 Shirt size Age 5/1/2023 $39.00 John S 11-12 Mary L 14 Peter S 9 5/5/...

3

I need to unpivot a table using fields specified in an array. I have the following query: select * FROM TEMP_TABLE_NAME T unpivot ( val_col for name_col in ( array_of_fields ) ); The issue i...
Hanan asked 1/3, 2021 at 16:19

2

Solved

Is there a Snowflake command that will transform a table like this: a,b,c 1,10,0.1 2,11,0.12 3,12,0.13 to a table like this: key,value a,1 a,2 a,3 b,10 b,11 b,13 c,0.1 c,0.12 c,0.13 ? This operat...
Rogatory asked 28/7, 2021 at 0:40

6

Solved

Is there a quick way to "unpivot" an Excel matrix/pivot-table (in Excel or elsewhere), without writing macros or other code ? Again, I can write code (C# or VBA or whatever) that does that myselfs...
Fowliang asked 20/8, 2015 at 10:1

10

Is there a unpivot equivalent function in PostgreSQL?
Azurite asked 15/7, 2009 at 0:8

5

Solved

I am having difficulties writing a Postgres function, as I am not familiar with it. I have multiple tables to import into Postgres with this format: id | 1960 | 1961 | 1962 | 1963 | ... __________...
Ovenbird asked 2/9, 2014 at 14:3

2

Solved

I have a problem statement at hand wherein I want to unpivot table in Spark SQL / PySpark. I have gone through the documentation and I could see there is support only for pivot, but no support for ...
Fourierism asked 26/2, 2017 at 6:44

7

Solved

Suppose I have the df below. I would like to combine the price columns and value columns so that all prices are in one column and all volumes are in another column. I would also like a third column...
Spermatophyte asked 30/6, 2022 at 1:28

9

Solved

UNPIVOT will not return NULLs, but I need them in a comparison query. I am trying to avoid using ISNULL the following example (Because in the real sql there are over 100 fields): Select ID, theVal...
Solfa asked 16/6, 2009 at 17:56

4

I'm trying to pivot a table around it's many columns to get to 3 columns (pivot, column name, value) so for example: name | age | gender ------+-------+--------- John | 20 | M Jill | 21 | F wou...
Milburt asked 18/7, 2014 at 15:11

3

Solved

I have a DataFrame like this >>> df = pd.DataFrame([[1,1,2,3,4,5,6],[2,7,8,9,10,11,12]], columns=['id', 'ax','ay','az','bx','by','bz']) >>> df id ax ay az bx by bz 0 1 1 2 3 4...
Mountainside asked 28/3, 2019 at 16:52

3

Solved

How can i convert multiple column to row accoding by followed sample? For solution, i inspected many sample for example pivot, decode etc. but i did not reach absolute solution. +---------+-------...
Purge asked 21/7, 2016 at 12:21

4

Solved

Not sure what functions to call, but transpose is the closest thing I can think of. I have a table in BigQuery that is configured like this: but I want to query a table that is configured like t...
Coquette asked 8/1, 2015 at 2:48

3

Solved

I am using SQL server 2008 and I am trying to unpivot the data. Here is the SQL code that I am using, CREATE TABLE #pvt1 (VendorID int, Sa int, Emp1 int,Sa1 int,Emp2 int) GO INSERT INTO #pvt1 VALU...
Casern asked 4/9, 2013 at 14:57

7

Solved

Looking for elegant (or any) solution to convert columns to rows. Here is an example: I have a table with the following schema: [ID] [EntityID] [Indicator1] [Indicator2] [Indicator3] ... [Indicat...
Minnaminnaminnie asked 2/8, 2013 at 21:13

3

I have the below table as a result of SUM(Case....End). Account Product_A Product_B Product_C 101 1000 2000 3000 102 2000 1000 0 103 2000 1000 0 104 2000 1000 2000 I want to return it back to the ...
Tangerine asked 8/10, 2020 at 17:48

3

ID | a | b | c 1 | a1 | b1 | c1 2 | a2 | b2 | c2 How do I reorganize the rows as ID, columntitle, value? 1 | a1 | a 1 | b1 | b 1 | c1 | c 2 | a2 | a 2 | b2 | b 2 | c2 | c
Feinleib asked 3/3, 2013 at 9:40

1

Solved

I want to turn column into a new rows and save the values. For example: BEFORE NAME COMDEDY HORROR ROMANCE brian 10 20 14 tom 20 10 11 AFTER NAME GANRE RATING brian comedy 10 brian horror 20 brian...
Waltner asked 5/9, 2020 at 10:30

2

Solved

Is there a way to perform a select and return a static list? Something like the following: select * from ('CA', 'FB', 'FC') It should return CA FB FC
Someplace asked 7/5, 2020 at 21:39

© 2022 - 2025 — McMap. All rights reserved.