Oracle之视图联合查询加排序问题
在公司修改bug,有这样的需求:需要从两张视图中查出相同字段的数据,按照导师姓名先排序,再按照学号排序
union联合两张表,SELECT * from((SELECT DS_ID,PYLX_ID,YX_ID,DS_XM,XH,XM FROM PY_VIEW_YJSXX WHERE ID IN ('720c8511d1994434a55dae6f545652bc') )UNION ALL(SELECT DS_ID,PYLX_ID,YX_ID,DS_XM,XH,XM FROM PY_VIEW_ZJSXX WHERE ID IN ( '11' ) )) xsxx
ORDER BY
NLSSORT( xsxx.DS_XM, 'NLS_SORT = SCHINESE_PINYIN_M' ),
xsxx.XH
于是就有了上述的sql语句,是组长手把手现教的