0

The question is the following: How can I group in the table, but showing all the data the last row the group

Query Table

score  team    stadium            date
20     Ajax    Arena Stadium      '26/Feb/2020'
10     Madrid  Santiago Bernabeu  '26/Feb/2020'
10     Ajax    Arena Stadium      '22/Feb/2020'

Expected result

score  team    stadium            date
20     Ajax    Arena Stadium      '26/Feb/2020'
10     Madrid  Santiago Bernabeu  '26/Feb/2020'

Regards

lyonTypescript
  • 125
  • 1
  • 3
  • 10

1 Answers1

1

Try this

SELECT score, team, stadium, date
FROM (
    SELECT 
        , ROW_NUMBER() OVER(PARTITION BY score, team ORDER BY date DESC) AS rn
    FROM yourTable
) tbl
WHERE rn = 1
Eric
  • 3,165
  • 1
  • 19
  • 25