在联接或位置内的条件有什么不同(表现、最佳实践等.)在JOIN子句中添加条件与WHERE子句之间?例如.。-- Condition in JOINSELECT *FROM dbo.Customers AS CUSINNER JOIN dbo.Orders AS ORD
ON CUS.CustomerID = ORD.CustomerIDAND CUS.FirstName = 'John'-- Condition in WHERESELECT *FROM
dbo.Customers AS CUSINNER JOIN dbo.Orders AS ORD
ON CUS.CustomerID = ORD.CustomerIDWHERE CUS.FirstName = 'John'你喜欢哪一个(也许是为什么)?
3 回答
芜湖不芜
TA贡献1796条经验 获得超7个赞
SELECT *FROM dbo.Customers AS CUS LEFT JOIN dbo.Orders AS ORD ON CUS.CustomerID = ORD.CustomerIDWHERE ORD.OrderDate >'20090515'SELECT *FROM dbo.Customers AS CUS LEFT JOIN dbo.Orders AS ORD ON CUS.CustomerID = ORD.CustomerIDAND ORD.OrderDate >'20090515'
SELECT *FROM dbo.Customers AS CUS LEFT JOIN dbo.Orders AS ORD ON CUS.CustomerID = ORD.CustomerIDWHERE ORD.OrderID is null
杨__羊羊
TA贡献1943条经验 获得超7个赞
OUTER JOIN
添加回答
举报
0/150
提交
取消