sherbug1015
asked on
Pivot Query
Please see attached ON the DATABASE TABLE TAB. This is my source DATA.
Please see attached ON the How it Should look TAB.
Mapping FROM the DATABASE TABLE
Occurence = Wall
COLUMN 1 = The multiplier WHERE Priority=1 FROM the databasetable
COLUMN 2 = The multiplier WHERE Priority=2 FROM the databasetable
Please see attached ON the What Query returns tab
This is not what I want. I need TO PIVOT the priority As the columns AND THEN DROP the multiplier VALUES IN each COLUMN according TO priority
Here is my query. Can someone please take a look and tell me what I should do to make this work. If possible, could you provide some code.
Thanks.
select Occurence AS Wall, Multiplier, [1], [2]
from (
select Occurence, Multiplier,Priority, row_number() over (partition by Occurence ORDER BY Occurence) rn
from tblCadenceStrategydetails_ test
) o
pivot(Max(Priority) for rn in ([1], [2])) p
ORDER BY Occurence
I am really in a bind to get this working. Any help would be greatly appreciated.
pivotquestion.xlsx
Please see attached ON the How it Should look TAB.
Mapping FROM the DATABASE TABLE
Occurence = Wall
COLUMN 1 = The multiplier WHERE Priority=1 FROM the databasetable
COLUMN 2 = The multiplier WHERE Priority=2 FROM the databasetable
Please see attached ON the What Query returns tab
This is not what I want. I need TO PIVOT the priority As the columns AND THEN DROP the multiplier VALUES IN each COLUMN according TO priority
Here is my query. Can someone please take a look and tell me what I should do to make this work. If possible, could you provide some code.
Thanks.
select Occurence AS Wall, Multiplier, [1], [2]
from (
select Occurence, Multiplier,Priority, row_number() over (partition by Occurence ORDER BY Occurence) rn
from tblCadenceStrategydetails_
) o
pivot(Max(Priority) for rn in ([1], [2])) p
ORDER BY Occurence
I am really in a bind to get this working. Any help would be greatly appreciated.
pivotquestion.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.