Multiple max values in a query

前端 未结 6 2003
余生分开走
余生分开走 2021-01-12 21:08

I know the title does not sound very descriptive, but it is the best I could think of:

I have this table

ID     BDATE      VALUE
28911  14/4/2009  44820
2         


        
6条回答
  •  甜味超标
    2021-01-12 21:41

    You can use analytics:

    select 
          id, bdate, value 
        from
          (
            select
              id, bdate, value, max( bdate ) over ( partition by id ) max_bdate
            from
              myview
          )
        where
          bdate = max_bdate
    

提交回复
热议问题