You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- Query from https://learnsql.com/blog/what-is-common-table-expression/
WITH highest AS (
SELECT
branch,
date,
MAX(unit_price) AS highest_price
FROM sales
GROUP BY branch, date
)
SELECT
sales.*,
h.highest_priceFROM sales
JOIN highest h
ONsales.branch=h.branchANDsales.date=h.date
an AliasedQuery needs to be created with the name needed to be passed twice (into AliasedQuery and in with_)
In order to create a CTE query like this one
an
AliasedQuery
needs to be created with the name needed to be passed twice (intoAliasedQuery
and inwith_
)However, I think this syntax would be a lot easier to work with.
Where a
QueryBuilder
could be aliased which would signify it can be used liked aAliasedQuery
The text was updated successfully, but these errors were encountered: