Why no previous/next operation?


What is the least painful way to create a query that filter based on more than one row? This is what I had in mind:

SELECT MV from (SELECT count(value1) as CT, mean(value2) as MV from XYZ group by time(1d)) WHERE CT>0 AND previous(CT)>0

I tried to go without prevoius() by using difference(), but ran into another problem:

SELECT MV from (SELECT CT, difference(CT) as DCT, MV from (…)) where CT>0 and CT != DCT
ERR: mixing aggregate and non-aggregate queries is not supported