本文介绍了SQL删除最新记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除指定产品ID和用户ID的最后一条记录。



我目前的代码是

从ShoppingBasket中删除top(1),其中productID = 1 AND userID =''admin''





但这会删除第一个而不是最后一条记录,并使用''order by desc''不起作用。

解决方案



I want to delete last record where product ID and userID are specified.

my current code is

delete top (1) from ShoppingBasket where productID=1 AND userID=''admin'' 



but this deletes the first not the last record, and using ''order by desc'' does not work.

解决方案



这篇关于SQL删除最新记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 09:26
查看更多