Skip to content

Bug Report for sql-aggregation-execution-order #4416

@yusufunlu

Description

@yusufunlu

Bug Report for https://neetcode.io/problems/sql-aggregation-execution-order

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

In order by we can use alias which already defined in select since select is working before order by.

Following solution is enough
select country, year, SUM(gold + silver + bronze) as total_medals from olympic_medals
where category !='Gymnastics'
group by country,year
having sum(gold+silver+bronze) > 20
order by total_medals desc
limit 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions