Search code examples
sqlms-accessgroup-bymaxms-access-2016

make query to display greatest data in access


I have a table in access:

 id | holiday
-----|----------
2020 | 40
2020 | 39
4644 | 23
4644 | 22

I want my query to display the greatest value for holiday

something like this:

  id | holiday
-----|----------
2020 | 40
4644 | 23

any ideas would be highly appreciated. Perhaps using sql in acccess?


Solution

  • That's a basic aggregation query:

    select id, max(holiday) max_holiday
    from mytable
    group by id