quary
quary copied to clipboard
[QUA-153] Incorrect inference with GroupBy
In the following query,
WITH
isa_contributions_with_year AS (
SELECT
cs.account_id,
cs.date,
cs.amount,
ds.year
FROM
q.stg_isa_contributions AS cs
INNER JOIN q.stg_isa_dates AS ds ON julianday (cs.date) BETWEEN julianday (ds.start_date) AND julianday (ds.end_date)
)
SELECT
account_id,
year,
SUM(amount) AS contribution_to_account
FROM
isa_contributions_with_year
GROUP BY
account_id,
year
ORDER BY
year,
account_id
The inference engine wrongly infers that year is unique.
From SyncLinear.com | QUA-153