GROUP_CONCAT 增加序号
SELECT
group_concat(
concat(
@j :=
IF
( @p = s.semester_id, @j + 1, IF ( @p := s.semester_id, 1, 1 ) ),
'.',
s.item
) SEPARATOR ', '
) FirstName,
s.*
FROM
scd_cost_charge_item s
WHERE
s.sys_state = 0
GROUP BY
s.semester_id;
本文来自博客园,作者:格,转载请注明原文链接:https://www.cnblogs.com/yuangyuan/p/16449806.html