ORACLE/SQL: wm_concat & order by

前端 未结 6 928
梦如初夏
梦如初夏 2020-12-19 18:17

I\'m using oracle 11 (not sure about the exact version, but since LISTAGG doesn\'t work, I suppose it\'s not release 2) through ODBC and crystal reports 2008.

Here

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 18:52

    If you give the sub query in the from clause a name you can then refer to columns in the sub query itself

    SELECT t1.TASK_CARD
    , WM_CONCAT(t1.code) as ZONES
    FROM 
    (SELECT TASK_CARD, CODE, CONTROL_CATEGORY FROM ODB.TASK_CARD_CONTROL ORDER BY CODE) t1
    WHERE t1.CONTROL_CATEGORY = 'ZONE'
    GROUP BY t1.TASK_CARD
    

提交回复
热议问题