Delete 时使用 Join
文章目录

Delete 时使用 Join

1
2
3
4
5
DELETE w
FROM WorkRecord2 w
INNER JOIN Employee e
ON EmployeeRun=EmployeeNo
Where Company = '1' AND Date = '2013-05-06'

DELETE后面必须跟上一个表名或者别名

或者用另一种exists的方法

Delete时使用exists

1
2
3
4
5
6
delete from meta_xml
where exists (
select 1 from meta_row r
where meta_xml.did = r.did
and datadate = @datetodel
)