根据id删除 该sql的查询结果 select * from t_project_disclose tpd where tpd.id in ( select tpd.id from t_project_disclose tpd where tpd.project_plan_id not in ( select opp.ID from t_project_disclose tpd join overhaul_project_plan opp on tpd.project_plan_id = opp.ID ) and tpd.version_id = 'd2576fc1e2be4258ac8b624b926cc44c');
时间: 2024-03-06 10:50:56 浏览: 64
剑桥1到剑9同义词替换_1040.doc
根据您提供的 SQL 查询语句,可以使用以下 SQL 语句来根据 id 删除查询结果中的数据:
```
DELETE FROM t_project_disclose WHERE id IN (
SELECT tpd.id FROM t_project_disclose tpd
WHERE tpd.project_plan_id NOT IN (
SELECT opp.ID FROM t_project_disclose tpd
JOIN overhaul_project_plan opp ON tpd.project_plan_id = opp.ID
)
AND tpd.version_id = 'd2576fc1e2be4258ac8b624b926cc44c'
);
```
上述 SQL 语句中,使用了嵌套的 SELECT 语句来获取需要删除的数据的 id,然后使用 DELETE 语句将其从表 `t_project_disclose` 中删除。其中,子查询的条件与原查询语句相同,即 `tpd.project_plan_id NOT IN (SELECT opp.ID FROM t_project_disclose tpd JOIN overhaul_project_plan opp ON tpd.project_plan_id = opp.ID) AND tpd.version_id = 'd2576fc1e2be4258ac8b624b926cc44c'`。请注意备份数据后再进行删除操作。
阅读全文