Skip to content
Advertisement

Tag: unpivot

Transpose using column names in Oracle SQL

I have worked a bit in pivot/unpivot in Oracle SQL but this one seems little complex and need some help here. the below is my table design year Comp_A_prev_yr_due_ct Comp_A_prev_yr_due_amt Comp_A_curr_yr_due_ct Comp_A_Curr_yr_due_amt 2019 100 1000 101 1001 like this I have multiple companies as columns (each as a set of 4) and the report needs to be kinda be reader

UNPIVOT Holiday Hours

I have a table, that keeps track of store holiday hours: This is a highly oversimplified table. There’s about 30 columns horzontially consisting of store operating hours by date – It continues (DATE3, TIMES3, DATE4, TIMES4, etc). I need to unpivot the values vertically, ensuring the date and time values are on the same record. (NOTE: Once I figure out

Insert 2 select in same insert SQL

i have a problem, i would like use 2 select to insert in new table but i don’t know if it’s possible… my code : I would like insert the second part ( select COLONNE01….) in the first part instead of “INSERT HERE” DATA OLD TABLE : COLUMNS 1 (“PKID1″, one”,”two”,”three”) COLUMNS 2 (“PKID2″,”one”,”two”, “three”) New TABLE : (PKID1, one,

TSQL PIVOT/UNPIVOT Multiple Summarized Columns

Seems this is a popular topic but I can’t seem to replicate other answers. I have data that is already summarized by month/year for multiple categories. What I’m trying to get is this Here’s the query to provide the data I’ve used PIVOT a bunch of times, but with a single “category” of data. I can’t seem to get anything

logic to create more rows in sql

I have a table1 that I wanted to transform into the expected table. Expected table logic for columns: cal: comes from cal of table1. ID comes from the ID of table1. code: this is populated with lp or fp depending upon if we have a value in f_a then we create a new record with fp as code. corresponding to

Advertisement