原来,union的优先级很高。比如
复制代码
1
2
3
4
5
6
7
8select stdname,[subject]='化学',化学 as score from #student2 union all select stdname,[subject]='数学',数学 as score from #student2 union all select stdname,[subject]='物理',物理 as score from #student2 union all select stdname,[subject]='语文',语文 as score from #student2 order by stdname,[subject]
等同于
复制代码
1
2
3
4
5
6
7
8
9
10select * from( select stdname,[subject]='化学',化学 as score from #student2 union all select stdname,[subject]='数学',数学 as score from #student2 union all select stdname,[subject]='物理',物理 as score from #student2 union all select stdname,[subject]='语文',语文 as score from #student2 ) as a order by stdname,[subject]
最后
以上就是简单彩虹最近收集整理的关于哇,union的优先级很高嘛的全部内容,更多相关哇,union内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复