62,046
社区成员
发帖
与我相关
我的任务
分享
select * from tb a where pkid =
(
select max(pkid) from tb where nid = a.nid and sid = a.sid and price =
(
select max(price) from tb where nid = a.nid and sid = a.sid
)
)
DELETE tb
WHERE EXISTS
(
SELECT * FROM tb tb2
WHERE tb.sid=tb2.sid AND tb.nid=tb2.nid
AND tb.price<=tb2.price
AND tb.pkid<tb2.pkid
)