I have following type of data, where sum of interval_mins is supposed to be equal to Total_mins for a particular ID#. I need the rows where it is missing a row for Interval_mins eg for ID# 20. How can I do that? Thanks,
ID Date Interval_mins Total_mins
10 4/1/16 60 80
10 4/1/16 20 80
20 4/1/16 60 85
If you are just looking for ids were the totals do not match:
select id
from t
group by id
having max(total_mins) <> sum(interval_mins);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.