我需要根据两个表中的混合where语句从表中删除一些行。
我试过了:
delete from tblI t1, tblS t2
where t2.rcode = 'ALA' and t1.sid > 5
但是我收到语法错误。请帮我解决这个问题
将其更改为JOINS:
delete from tblI
inner join tblS
on tblI.sourceid = tblS.sourceid
where tblS.rcode = 'ALA' and tblI.sourceid > 5
但仍有问题,请帮助。
答案 0 :(得分:21)
你必须告诉它要删除哪个表。
delete t1
from tblI t1
join tblS t2 on t1.sid = t2.sid
where t2.rcode = 'ALA'
and t1.sid > 5