Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- *
- from
- (
- select
- c.title,
- sum(a.total_minutes) sum_total_minutes
- from report_total_minutes_by_day a
- inner join data_gateway b on a.gateway_id = b.id
- inner join data_group_rca c on b.rca_id = c.id
- where b.is_deleted = 0
- and b.title is not null
- and a.report_date >= '2015-01-01'
- and a.report_date <= '2015-01-31'
- group by c.id
- ) totals
- where totals.sum_total_minutes > 999;
Advertisement
Add Comment
Please, Sign In to add comment