SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
select AA.TICKET_GAME, AA.TICKET_ID, AA.TICKET_MULTIPLIER --,REPLACE( concat(AA.CCombo,';') ';;', ';') as COMBINATION from ( SELECT A.TICKET_GAME, A.TICKET_ID, A.TICKET_MULTIPLIER, listagg(A.combo, '; ') within group (order by A.TICKET_ID, A.NMBR) AS CCombo FROM ( SELECT TT.TICKET_ID, TT.TICKET_GAME, TT.TICKET_MULTIPLIER, TM.NMBR, CONCAT(CONCAT(TM.NMBR, ': '), RTRIM(TO_CHAR(TM.MASK), ',')) AS combo FROM T$TICKET tt, (SELECT m.TICKET_ID, numbers.n AS NMBR, COALESCE(t.MASK, ' ') AS MASK FROM (SELECT DISTINCT TICKET_ID FROM T$MASK) m CROSS JOIN ( SELECT level AS n FROM dual CONNECT BY level <= 10 ) numbers LEFT JOIN T$MASK t ON m.TICKET_ID = t.TICKET_ID AND numbers.n = t.NMBR ORDER BY m.TICKET_ID, numbers.n) TM WHERE tt.TICKET_ID = tm.TICKET_ID ) A GROUP BY A.TICKET_GAME, A.TICKET_ID, A.TICKET_MULTIPLIER ) AA;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear