Multiple SELECT with multiple WHERE
This is not working. Not a master at SQL so could use some help.
SELECT
AVG(reading) AS overall,
AVG(reading) AS 7DAY WHERE (readdate >= CURDATE() - INTERVAL 7 DAY) AND (reading > 0) AND (readdate < CURDATE() + INTERVAL 7 DAY),
AVG(reading) AS 14DAY WHERE (readdate >= CURDATE() - INTERVAL 14 DAY) AND (reading > 0) AND (readdate < CURDATE() + INTERVAL 14 DAY)
FROM meter
I want to display this in a Dashboard Panel as 7 Day Average, 14 Day Average, Overall Average.
Subject
Written By
Posted
Multiple SELECT with multiple WHERE
August 24, 2018 04:33AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.