GROUP_CONCAT 函数使用,字符串大小设置

时间:2023-01-21 20:12:29

SET group_concat_max_len = 20000;

 

a.

select group_concat(ipaddress) from t_ip 返回逗号隔开的串
select group_concat(id) from t_ip 返回byte[]
select group_concat(CAST(id as char)) from t_dep 返回逗号隔开的串
select group_concat(Convert(id , char)) from t_dep 返回逗号隔开的

b.

SELECT  m.bill_id as billId,
        m.bill_details_id as billDetailsId,
        GROUP_CONCAT(m.ime)  as imes
      FROM (SELECT
          b.id as bill_id,
          b.bill_no,
          d.id as bill_details_id,
          i.ime
        FROM c2_delivery_bill b,
             c2_delivery_bill_details d,
             c2_delivery_bill_ime_details i
  
        WHERE d.id = i.bill_details_id
        and b.id = d.BILL_ID_FK
        and ime in
        (
        '869357020189175',
'869357020487678'
        )
        ) m
      GROUP BY  m.BILL_ID,
               m.bill_details_id ;