May 10, 2011 at 6:51 am
Hi All,
i have 9 columns say qso,cp,cd,qsoYESpercentage,cpYESpercentage,cdYESpercentage,qsoNOpercentage,qsoNOpercentage,qsoNOpercentage. I get one row as i execute the query with above columns. the values are
qso, -- 130
cp, -- 120
cd, -- 125
qsoYESpercentage, -- 99.19%
cpYESpercentage, -- 100.00%
cdYESpercentage, -- 100.00%
qsoNOpercentage, -- 0.81%
qsoNOpercentage, -- 0.00%
qsoNOpercentage -- 0.00%
now i want to unpivot these values. it shoudl appear like :
YES NO
qso 99.19% 0.81%
cp 100.00% 0.00%
cd 100.00% 0.00%
when i do unpivoting, the values appear as
Stage YesNo
cd 99.19 0.00
cd 99.19 0.81
cd 100.000.00
cd 100.000.81
cp 99.19 0.00
cp 99.19 0.81
cp 100.000.00
cp 100.000.81
qso 99.19 0.00
qso 99.19 0.81
qso 100.000.00
qso 100.000.81
it is something like doing cross join and not getting the correct values..someone please help me on this?? thanks a lot for your help..
May 10, 2011 at 7:46 am
Why do you get 3 qsoNOpercentage columns? Without knowing the data structure etc., I think you would be better off going a step back and reworking the query that gives you the one row of results to give you what you want instead of a mixed up row of data that you want to unpivot.
May 11, 2011 at 12:09 am
thanks guys..resolved now...inserted data into a temporary table and used Union all query to get the data.so now i get only 3 rows:)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply