常将JOIN用于SELECT语句中,如
SELECT a.ClassID,a.ClassName,b.StudentID,b.StudentName
FROM T_Class a INNER JOIN T_Student b ON b.ClassID=a.ClassID
其实JOIN亦可用于UPDATE/DELETE语句,可参考SQL Server联机帮助文档FROM语句部分
Code
例如:
DELETE b
FROM T_Student a RIGHT JOIN T_Class b ON b.classId = a.classId
WHERE a.classid is null
至于其与NOT IN效率,有待测试、考证