SQL Select newest records that have distinct Name column

前端 未结 4 990
一生所求
一生所求 2020-12-12 15:30

I did search around and I found this SQL selecting rows by most recent date Which is so close to what I want but I can\'t seem to make it work.
I get an error Column \'I

4条回答
  •  青春惊慌失措
    2020-12-12 15:30

    select * from (
        Select
            ID, Name, Price, Date,
            Rank() over (partition by Name order by Date) RankOrder
        From table
    ) T
    where RankOrder = 1
    

提交回复
热议问题