Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. with days as (select day::date
  2. from generate_series(date '2013-01-01', date '2013-01-01' + 365, interval '1
  3.  
  4. day' day) day
  5. )
  6. select 'Inspections'::text as data_label,
  7. count(i.reporting_id) as daily_count, d.day as date_column
  8. from days d
  9. left join inspection i on i.close_case_date = d.day
  10. group by d.day
  11. order by d.day
  12.  
  13. data_label | daily_count | date_column
  14. Inspections 1 01/01/13
  15. Inspections 2 01/02/13
  16. Inspections 4 01/04/13
  17. Inspections 8 01/06/13
  18.  
  19. data_label | daily_count | date_column
  20. Inspections 1 01/01/13
  21. Inspections 2 01/02/13
  22. Inspections 0 01/03/13
  23. Inspections 4 01/04/13
  24. Inspections 0 01/05/13
  25. Inspections 8 01/06/13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement