1

帮我为sqlite db写delete语句

'rating' table schema (rID, mID, rate, pub)

此查询将仅返回一个元组

select * from rating
where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03'

表中的所有列都是非唯一的

这些查询不起作用

delete from rating where rID,mID, rate, pub in 
    (select * from rating where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03')

delete from rating where rID=G.rID,mID=G.mID, rate=G.rate, pub=G.pub
    (select * from rating where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03') as G
4

1 回答 1

1

这有什么问题吗?

delete from rating
where rID = 101 
and mID=678 
and rate = 34.5 
and pub='2012-11-03'

任何 select 语句都可以转换为 delete 语句,该语句影响与从 select 返回的行相同的行。实际上,这是测试将删除哪些行的好方法。

于 2013-02-10T11:49:45.847 回答