group_concat

SELECT
cif.cc_name,
card.cd_idnum,
card.cd_card,
su.s_tell,
GROUP_CONCAT(pro.p_number)as p_number,
GROUP_CONCAT(pro.p_name) as p_name,
pro.p_all_region,
pro.p_part_region,
pro.p_cash,
GROUP_CONCAT(re.t_exchange_quantity)as t_exchange_quantity,
su.s_total_integral,
su.s_total_cash,
su.s_branch,
re.t_exchange_model,
su.s_audit_date,
su.audit_status,
su.s_date_save
FROM `'.$this->success_tb.'` AS su
LEFT JOIN `'.$this->card_tb.'` AS card ON su.s_card_number=card.cd_md5
LEFT JOIN `'.$this->cif_tb.'` as cif ON  card.cc_cif=cif.cc_cif
LEFT JOIN `'.$this->record_tb.'` AS re ON su.serial_number = re.serial_number
LEFT JOIN `'.$this->product_tb.'` AS pro ON re.p_id = pro.p_id
'.$this->arr_obj->select_within_where($datas).'
GROUP BY su.serial_number

你可能感兴趣的:(group_concat)