sqlite equivalent of row_number() over ( partition by …?

前端 未结 5 1589
说谎
说谎 2020-11-30 08:32

I\'d like to know if it\'s possible to do the following using a single sqlite statement:

My table looks something like this:

|AnId|UserId|SomeDate|So         


        
5条回答
  •  萌比男神i
    2020-11-30 09:27

    If you already haven't got the answer. If it's one table, then you don't need any joins. You can just use:

    Delete From data
    where AnId not in (Select AnId
                       from data
                       Order by SomeDate DESC
                       Limit 10)
    

提交回复
热议问题