Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with days as (select day::date
- from generate_series(date '2013-01-01', date '2013-01-01' + 365, interval '1
- day' day) day
- )
- select 'Inspections'::text as data_label,
- count(i.reporting_id) as daily_count, d.day as date_column
- from days d
- left join inspection i on i.close_case_date = d.day
- group by d.day
- order by d.day
- data_label | daily_count | date_column
- Inspections 1 01/01/13
- Inspections 2 01/02/13
- Inspections 4 01/04/13
- Inspections 8 01/06/13
- data_label | daily_count | date_column
- Inspections 1 01/01/13
- Inspections 2 01/02/13
- Inspections 0 01/03/13
- Inspections 4 01/04/13
- Inspections 0 01/05/13
- Inspections 8 01/06/13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement