Multiple max values in a query

前端 未结 6 2004
余生分开走
余生分开走 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:29

    We can use multiply columns in an IN clause:

    select id, bdate, value 
    from myview 
    where (id, bdate) in
        (select id, max(bdate)
         from myview group by id)
    /
    

提交回复
热议问题