SELECT
	pzrq,pzbh,pzlx,'example-1001','演示账套',id AS vou_id,subjcode,kmmc,zy,jfje,dfje,0,0,
	if(@pzrq = pz.pzrq 
		AND @pzbh = pz.pzbh
		and @pzlx = pz.pzlx,
		@rank := @rank + 1,
		@rank := 1 
		) AS rank_no,
		@pzrq := pz.pzrq,
		@pzbh := pz.pzbh, 
		@pzlx := pz.pzlx
FROM
	pz,
	( SELECT * FROM hs_subject WHERE account_code = 'example-1001' AND YEAR = '2017' ) b,
	( SELECT @pzrq := null, @pzbh := null, @pzlx := null, @rank := 0 ) temp
WHERE
	pz.kmmc = b.subjname

有朝一日同风起,扶摇直上九万里