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;
posted @ 2022-07-21 09:57    阅读(254)  评论(0编辑  收藏  举报