I tried to use a select query in which contains both where and sum aggreation query.But its shows error while executing the query . Below is sample table
|sensorid | timestamp | reading |
====================================
|1 | 1604192522 | 10 |
|1 | 1604192525 | 15 |
|2 | 1605783723 | 8.1 |
My query is
select date_trunc('day', v.timestamp) as day,sum(reading) from sensor v(timestamp,sensorid) group by (DAY) having sensorid=1;
while executing below error occured
Cannot use column sensorid outside of an Aggregation in HAVING clause. Only GROUP BY keys allowed here.]