【发布时间】:2021-07-05 06:16:10
【问题描述】:
我已经写了以下选择:
SELECT r.ID, r.NAME, r.REMARK, u.user_id, u.deadline, u.creation_date, d.NEXT_TEST_DATE, t.TEST_INTERNAL_EXTERNAL FROM reminder r, reminder_users u, device d, device_test t where r.id = u.reminder_id and u.receipt = 0 and (regexp_replace(r.origin_values, '[^0-9]', '')) = d.id and d.NEXT_TEST_INT_ID = t.id and t.TEST_INTERNAL_EXTERNAL = 0 and r.NAME like '%Interne%' and r.NAME not like '%Externe%' and u.deadline <> d.NEXT_TEST_DATE_INTERNAL and u.DEADLINE > sysdate GROUP BY r.ID, r.NAME, r.REMARK, u.user_id, u.deadline, u.audt_creation_date, d.NEXT_TEST_DATE_INTERNAL, t.TEST_INTERNAL_EXTERNAL ORDER BY u.deadline;
我想要做什么:我想删除提醒中的行,这些行由描述的选择获取。
我尝试了什么:
DELETE from REMINDER where id in (SELECT r.ID, r.NAME, r.REMARK, u.user_id, u.deadline, u.audt_creation_date, d.NEXT_TEST_DATE_INTERNAL, t.TEST_INTERNAL_EXTERNAL FROM reminder r, reminder_users u, device d, device_test t where r.id = u.reminder_id and u.receipt = 0 and (regexp_replace(r.origin_values, '[^0-9]', '')) = d.id and d.NEXT_TEST_INT_ID = t.id and t.TEST_INTERNAL_EXTERNAL = 0 and r.NAME like '%Interne%' and r.NAME not like '%Externe%' and u.deadline <> d.NEXT_TEST_DATE_INTERNAL and u.DEADLINE > sysdate GROUP BY r.ID, r.NAME, r.REMARK, u.user_id, u.deadline, u.audt_creation_date, d.NEXT_TEST_DATE_INTERNAL, t.TEST_INTERNAL_EXTERNAL ORDER BY u.deadline);
结果:00907. 00000 - "missing right parenthesis"
我想知道我是否可以以这种方式基本上删除这些行。我也试过'exists'导致同样的错误。
有什么建议吗?提前致谢!
【问题讨论】:
-
JOIN。JOIN。JOIN.
标签: sql oracle join sql-delete