Created
June 5, 2012 20:51
-
-
Save breckenedge/2877801 to your computer and use it in GitHub Desktop.
plant quarters pivot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT PLANT_NAME as 'plant name', [2009Q2], [2009Q3], [2009Q4], [2010Q1], [2010Q2], [2010Q3], [2010Q4], [2011Q1], [2011Q2], [2011Q3], [2011Q4], [2012Q1] | |
FROM | |
( | |
SELECT PLANT_CODE as plant, [QUARTER] as qtr FROM RECALL..[TREND_IR_FINDINGS] | |
WHERE CC_ASPECT LIKE '%H1b%' | |
) AS src | |
PIVOT | |
( | |
COUNT(qtr) FOR qtr IN ([2009Q2], [2009Q3], [2009Q4], [2010Q1], [2010Q2], [2010Q3], [2010Q4], [2011Q1], [2011Q2], [2011Q3], [2011Q4], [2012Q1]) | |
) AS pvt | |
JOIN RECALL..PLANT_NAMES ON PLANT_NAMES.PLANT_CODE = plant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment