Skip to content

Instantly share code, notes, and snippets.

@gordonje
Last active August 24, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gordonje/3975c652c02ae3b6fbe629e5c5ab0c44 to your computer and use it in GitHub Desktop.
Save gordonje/3975c652c02ae3b6fbe629e5c5ab0c44 to your computer and use it in GitHub Desktop.
Form 501 filed by month
select
date_part('month', a."RPT_DATE") as month,
date_part('year', a."RPT_DATE") as year,
COUNT(*) as the_count
from "F501_502_CD" a
join "FILER_FILINGS_CD" b
on a."FILING_ID" = b."FILING_ID"
where a."YR_OF_ELEC" = 2016
and a."FORM_TYPE" = 'F501'
group by 1, 2
order by 2, 1;
month year the_count
----- ------ ---------
12.0 2010.0 3
10.0 2011.0 1
11.0 2011.0 1
3.0 2012.0 1
5.0 2012.0 1
6.0 2012.0 1
11.0 2012.0 9
12.0 2012.0 5
1.0 2013.0 9
2.0 2013.0 7
3.0 2013.0 1
6.0 2013.0 1
8.0 2013.0 5
9.0 2013.0 1
11.0 2013.0 1
1.0 2014.0 2
3.0 2014.0 1
4.0 2014.0 3
6.0 2014.0 3
7.0 2014.0 9
8.0 2014.0 2
9.0 2014.0 3
10.0 2014.0 5
11.0 2014.0 48
12.0 2014.0 43
1.0 2015.0 34
2.0 2015.0 21
3.0 2015.0 18
4.0 2015.0 29
5.0 2015.0 21
6.0 2015.0 20
7.0 2015.0 25
8.0 2015.0 28
9.0 2015.0 26
10.0 2015.0 13
11.0 2015.0 25
12.0 2015.0 36
1.0 2016.0 108
2.0 2016.0 206
3.0 2016.0 267
4.0 2016.0 63
5.0 2016.0 24
6.0 2016.0 5
7.0 2016.0 4
8.0 2016.0 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment