geetha.jasmine (4/6/2013)
Hello,Thanks for sharing the URL which helps understand how to post the question.
I have rewrriten the question in a word document and has been attached as an attachment name pivotquery.docx
Please review and hope you help find me a solution.
Regards
a word document is not what is required...please reread the URL posted.
that said...does the following code give you some ideas...
SELECT FWEEK, prod_DESC,
cast (100 * SUM(CASE WHEN WarrantyStatus = 'IW' THEN orders ELSE 0 END) / SUM(Orders) as decimal(9,2)) as IWpercent,
cast (100 * SUM(CASE WHEN WarrantyStatus = 'OOW' THEN orders ELSE 0 END) / SUM(Orders) as decimal(9,2)) as OOWpercent,
cast (SUM(CASE WHEN WarrantyStatus = 'IW' THEN orders ELSE 0 END) as INT) AS IW,
cast (SUM(CASE WHEN WarrantyStatus = 'OOW' THEN orders ELSE 0 END) as INT) AS OOW
FROM gm_table
GROUP BY FWEEK, prod_DESC
HAVING (FWEEK = 201404)
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day