SELECT `Req`.*,
group_concat(AasDefRf.wip_start_time SEPARATOR "char(10)") wip_start_time,
group_concat(AasDefRf.pro_ready_time_1 SEPARATOR "char(10)") pro_ready_time_1,
group_concat(AasDefRf.pro_ready_time_2 SEPARATOR "char(10)") pro_ready_time_2,
group_concat(AasDefRf.pro_ready_time_3 SEPARATOR "char(10)") pro_ready_time_3,
group_concat(AasDefRf.lot_number SEPARATOR "char(10)") lot_number
FROM `reqs` AS `Req`
LEFT JOIN `aps_rel_infos` AS `AasDefRf` ON (`AasDefRf`.`req_id` = `Req`.`id`
AND `AasDefRf`.`status_code` <> 'D')
LEFT JOIN `contracts` AS `Contract` ON (`Req`.`rel_obj_id` = `Contract`.`id`)
WHERE `Req`.`ebs_order_number` = 12345654
GROUP BY `Req`.`id`
ORDER BY `Req`.`update_time` DESC LIMIT 50
直接用char(10)就行了,不用在意系统差别。
参考:
https://www.cnblogs.com/lxlck/p/3520616.html
https://www.cnblogs.com/appleat/archive/2012/09/03/2669033.html
group_concat里面还可以使用order by 。
SELECT locus,
GROUP_CONCAT(concat_ws(', ',id,journal)
ORDER BY id DESC SEPARATOR '. ')
FROM info
WHERE locus IN('AB086827','AF040764')
GROUP BY locus;