ask*_*low 2 sql sql-server except union-all
考虑我有一个查询
select * from A
Except
select * from B
union all
select * from B
except
select * from A
Run Code Online (Sandbox Code Playgroud)
查询处理如下
select *
from
(
select * from A
Except
select * from B
) a
union all
(
select * from B
Except
select * from A
) b
Run Code Online (Sandbox Code Playgroud)
如何在sql中定义处理顺序.在任何情况下它都会这样处理吗?
select * from A
Except
select * from
(
select * from B
union all
select * from B
) a
except
select * from A
Run Code Online (Sandbox Code Playgroud)
EXCEPT和UNION"从左到右"处理.这意味着没有任何括号来确定它们将按照它们出现在sql中的顺序进行处理.
https://msdn.microsoft.com/en-us/library/ms188055.aspx
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |