beowulf1416

Untitled

Feb 13th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. select
  2. *
  3. from
  4. (
  5. select
  6. c.title,
  7. sum(a.total_minutes) sum_total_minutes
  8. from report_total_minutes_by_day a
  9. inner join data_gateway b on a.gateway_id = b.id
  10. inner join data_group_rca c on b.rca_id = c.id
  11. where b.is_deleted = 0
  12. and b.title is not null
  13. and a.report_date >= '2015-01-01'
  14. and a.report_date <= '2015-01-31'
  15. group by c.id
  16. ) totals
  17. where totals.sum_total_minutes > 999;
Advertisement
Add Comment
Please, Sign In to add comment