GROUP_CONCAT - Heeyoung-Ahn/MariaDB-with-Excel-VBA GitHub Wiki
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val])
SELECT a.slip_no, 1 AS slip_gb, a.corporation_id, a.corporation_nm, a.currency_id, a.currency_un, a.offering_dt,
CONCAT('[', DATE_FORMAT(a.offering_dt, '%Y-%m'), ' ์ ๊ธฐ์
๊ธ] ', a.customer_nm, '\n',
(SELECT GROUP_CONCAT(CONCAT_WS(' ', tr.account_nm, ROUND(tr.rs_amt, 2)) ORDER BY tr.offering_sort_order SEPARATOR '\n')
FROM financial_db.v_regular_income_tr_basic tr
WHERE tr.rs_amt <> 0 AND tr.slip_no = a.slip_no
GROUP BY tr.slip_no)) AS sl_cmt,
a.user_id, a.user_nm
FROM financial_db.v_regular_offering a
WHERE a.user_id = query_urid AND DATE_FORMAT(a.offering_dt, '%Y%m') = DATE_FORMAT(query_dt, '%Y%m')
GROUP BY a.slip_no
ORDER BY a.slip_no;