mysql 拼接列,mysql 拼接列数据

SELECT IF(@ids=w.contract_id,@num:=@num,@num:=@num+1) AS num,@ids:=w.contract_id,w.* FROM

(SELECT (SELECT GROUP_CONCAT(project_name)

FROM production_income_data WHERE contract_id = a.contract_id) AS `names`,

(SELECT GROUP_CONCAT(project_code) FROM production_income_data

WHERE contract_id = a.contract_id) AS `codes`, a.*FROM production_income_data a )w

,(SELECT @num:=0) u,(SELECT @ids:=‘‘) m ORDER BY w.contract_id

mysql 拼接列,mysql 拼接列数据_第1张图片

mysql 拼接列数据

标签:rod   from   rom   name   sel   product   png   图片   contract

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:https://www.cnblogs.com/wjlwo2ni/p/11122278.html

你可能感兴趣的:(mysql,拼接列)