[英]How to delete a particular row after it is fetched using SELECT query in SQL?
How to delete a particular row after it is fetched using SELECT query in SQL?在 SQL 中使用 SELECT 查询获取特定行后如何删除它?
DELETE row1
FROM tablename
WHEN fetched
Suppose,I fetch a row using SELECT query in SQL.假设,我在 SQL 中使用 SELECT 查询获取一行。 Then I need to delete that row.
然后我需要删除该行。 Is triggers are used for it?
触发器是用来做的吗? How?
如何? Please write the code.
请写代码。
In MSSQL you can use CTE to delete a record when a select is performed.在 MSSQL 中,您可以使用 CTE 在执行选择时删除记录。 example is given below.
示例如下。
;WITH cte as (
select clientid
, status, Insertdate
from Yourtable
where clientid=1
)
delete from cte
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.