SELECT m.m , s.m , y.m
FROM (SELECT M FROM zmy WHERE STATE='月') as m,
(SELECT M FROM zmy WHERE STATE='季') as s,
(SELECT M FROM zmy WHERE STATE='年') as y
set @anum = 0;
set @bnum =0;
set @cnum = 0;
select anum, bnum, cnum, A, B, C from
(select (@anum := @anum + 1) as anum, zmy.月度 as 月度 from zmy where zmy .A is not null) as AA ,
(select (@bnum := @bnum + 1) as bnum, zmy.季度 as 季度 from zmy where zmy .B is not null) as BB,
(select (@cnum := @cnum + 1) as cnum, zmy.年度 as 年度 from zmy where zmy .C is not null) as CC
where anum=bnum and bnum=cnum
行号一致