Taking the record with the max date

前端 未结 6 1987
忘了有多久
忘了有多久 2020-12-08 10:05

Let\'s assume I extract some set of data.

i.e.

SELECT A, date
FROM table

I want just the record with the max date (for each value o

6条回答
  •  [愿得一人]
    2020-12-08 10:40

    A is the key, max(date) is the value, we might simplify the query as below:

    SELECT distinct A, max(date) over (partition by A)
      FROM TABLENAME
    

提交回复
热议问题