wm_concat 实现Oracle的行转换成列

接上编内容,http://zhangjiaweixt.iteye.com/blog/765181 两个表的结构不变 用WMSYS.WM_CONCAT 实现行转换成列 SELECT A.ZDBH,A.NAME,A.ADDRESS,A.TYPE,WMSYS.WM_CONCAT(B.MEAL_NAME) AS MEAL FROM TD_TERMINAL_MANAGE A ,POS_MEAL B WHERE A.MEAL_FLAG=1 AND A.FLAG=1 AND B.MEAL_ID NOT IN (SELECT D.CB FROM POS_TD_ORG D WHERE D.ZDBH = A.ZDBH) AND B.MEAL_ID !='0' GROUP BY A.ZDBH,A.NAME,A.ADDRESS,A.TYPE

你可能感兴趣的:(oracle,Blog)