I have this small query, BigQuery don't recognise the alias maxdate, I am trying to return the table but only for that last date
WITH
maxdate AS (
SELECT
MAX(DATE(SETTLEMENTDATE))
FROM
`biengine-252003.aemo2.daily`)
SELECT
*
FROM
`biengine-252003.aemo2.daily`
WHERE
DATE(SETTLEMENTDATE)= maxdate
You can also do something like:
Meantime, more effective way to achieve the goal is
You are trying to get the value of
maxdate
from your tablemaxdate
. Add alias to your column and use this.