Settings and Keywords
Keyword WITH
Use WITH keyword to declare aliases, variables, expressions. You can use the declared elements in the rest of the query.
Examples with a keyword WITH
WITH
entries AS array(L2EntryNew) AS 'l2',
max(l2[side == BID].price) AS 'maxBid',
min(l2[side == ASK].price) AS 'minAsk'
SELECT
max{}(maxBid) AS 'highBid',
min{}(minAsk) AS 'lowAsk'
FROM binance
OVER time(1m)
WHERE packageType == PERIODICAL_SNAPSHOT AND symbol == 'BTC/USDT'