为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm8
【操作系统】:x86
【CPU】:16
【问题描述】*:例如我要删除a表中id和b表中id一致且在b表中某个标识字段为false,例如:DELETE a FROM testdb.testa a JOIN testdb.testb b ON (a.id = b.id) WHERE b.active = false;
回答 0
暂无回答
wuran
CREATE TABLE testa(id CHAR(10)) ;
CREATE INDEX idx_1 ON testa(id) ;
CREATE TABLE testb(id CHAR(10),active CHAR(10)) ;
CREATE INDEX ix_2 ON testb(id) ;
delete from testa where id in (select a.id from testa a, testb b where a.id = b.id and b.active = ‘false’);
delete from testa a where exists(select 1 from testb b Where a.id = b.id and b.active = ‘false’);
delete testa from testa a,testb b where a.id=b.id and b.active = ‘false’;–不支持
delete from testa using testb b on a.id = b.id and b.active = ‘false’;–不支持
delete from ( select a.* from testa a,testb b where a.id = b.id );–不支持 无法修改与非键值保存表对应的列
CREATE TABLE testa(id CHAR(10)) ;
CREATE INDEX idx_1 ON testa(id) ;
CREATE TABLE testb(id CHAR(10),active CHAR(10)) ;
CREATE INDEX ix_2 ON testb(id) ;
delete from testa where id in (select a.id from testa a, testb b where a.id = b.id and b.active = ‘false’);
delete from testa a where exists(select 1 from testb b Where a.id = b.id and b.active = ‘false’);
delete testa from testa a,testb b where a.id=b.id and b.active = ‘false’;–不支持
delete from testa using testb b on a.id = b.id and b.active = ‘false’;–不支持
delete from ( select a.* from testa a,testb b where a.id = b.id );–不支持 无法修改与非键值保存表对应的列