Reputation: 19
I Want total number of row for each and for each day want consecutive max row count where condition numb>2 and calibration!=1 from table in pic below
and desire output should be
Upvotes: 1
Views: 55
Reputation: 50163
I think you want conditional aggregation:
select todaydate, count(*) as totalrow,
sum(case when (numb > 2 and calibration <> 1) then 1 else 0 end) as [max]
from table t
group by todaydate;
Upvotes: 2