SELECT A._date, sum(_Reading) as _Reading,
sum(Distinct _Reading2) as _Reading2
FROM table A
INNER JOIN (SELECT _ID, _date
FROM table
GROUP BY _ID, _date
HAVING count(_Period) = 5) B
on A._ID = B._ID
and A._Date = B._Date
GROUP BY A._Date
but the result is wrong.
1
Expert's answer
2016-08-03T08:58:29-0400
select _date, _id, sum(_reading), sum(_reading2) from table2 group by _id having count(_period) = 5
Comments
Leave a comment