Created
May 9, 2014 00:02
-
-
Save Bondifrench/6cd683605f7fbc26c034 to your computer and use it in GitHub Desktop.
Pivoting Finviews data, grouping by concepts, ordering by presentation order
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 | |
s.concept, | |
sum(case when s.fiscalyear =2009 then s.value else 0 end) as "2009", | |
sum(case when s.fiscalyear =2010 then s.value else 0 end) as "2010", | |
sum(case when s.fiscalyear =2011 then s.value else 0 end) as "2011", | |
sum(case when s.fiscalyear =2012 then s.value else 0 end) as "2012", | |
sum(case when s.fiscalyear =2013 then s.value else 0 end) as "2013", | |
sum(case when s.fiscalyear =2014 then s.value else 0 end) as "2014" | |
from (Select concept, fiscalyear, value, preorder from sec_sample | |
where cik=1288776 | |
AND periodfocus = 'FY' | |
AND rootconcept = 'Statement of Income' | |
Order by fiscalyear, concept | |
) as s | |
group by s.concept | |
order by min(s.preorder); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment