先执行两个查询,例如 SELECT * FROM TABLE WHERE 子句 和 DELETE * FROM TABLE WHERE 子句,效率不高.
It's not efficient to do two queries like SELECT * FROM TABLE WHERE clause and then DELETE * FROM TABLE WHERE clause.
所以我想进行 DELETE 查询并返回已删除的行(一个查询).
So I want to make DELETE query and return deleted rows (one query).
我尝试这样做:
DELETE OUTPUT DELETED.* FROM table WHERE clause但是我有一个错误:
SQLite exception: near "OUTPUT": syntax error如何正确制作或者可能有另一种返回已删除行的替代方法?
How to make it correctly or maybe there is another alternative way to return deleted rows?
推荐答案DELETE 语句有没有 OUTPUT 子句.
The DELETE statement has no OUTPUT clause.
执行SELECT后,所有重要数据都在缓存中,因此DELETE会运行得很快.
After doing the SELECT, all the important data is in the cache, so the DELETE will run quickly.
因为 SELECT 加 DELETE 是唯一的方式,所以它是最有效的方式.
And because SELECT plus DELETE is the only way, it is the most efficient way.
更多推荐
在sqlite中返回已删除的行
发布评论