在sql server中我们是不能再union查询中直接使用order by 进行排序的,因此我们必须使用一些比较巧妙的方法来得到我们想要的结果。1
2
3
4
5sqlStr = "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";
结果如下图所示: