SQL UNION All 排序问题 Posted on 2013-06-01 | In QTP | | 134 在sql server中我们是不能再union查询中直接使用order by 进行排序的,因此我们必须使用一些比较巧妙的方法来得到我们想要的结果。12345sqlStr = "select * from ("; sqlStr += "select NodeID,NodeName from Case_Tree where RootType=2 and NodeType=2"; sqlStr += " union all "; sqlStr += "select ActionID,ActionName from Case_Action where ActionCategory = 'Function'"; sqlStr += ") as T order by NodeName"; 结果如下图所示: 欢迎您扫一扫上面的微信公众号,订阅我的博客! 分享创造价值,您的支持将鼓励我继续前行! Donate WeChat Pay Alipay Post author: 唐胡璐 Post link: http://izheyi.com/2013/06/01/SQL-UNION-All-排序问题/ Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.