quary icon indicating copy to clipboard operation
quary copied to clipboard

[QUA-153] Incorrect inference with GroupBy

Open benfdking opened this issue 1 year ago • 1 comments

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

benfdking avatar May 26 '24 15:05 benfdking