^_^,笨方法,用临时表 SELECT avg(fe) as mfe,avg(si) as msi,mdate,... into #temp and mdate BETWEEN :rq1 and :rq2 group by mdateselect max(mfe) as mfe_max,max(msi) as msi_max from #temp drop table #temp
SELECT avg(fe) as mfe,avg(si) as msi,mdate,... into #temp and mdate BETWEEN :rq1 and :rq2 group by mdateselect max(mfe) as mfe_max,max(msi) as msi_max from #temp drop table #temp
我在另一个贴回答了,你没看吗?select case when avg(fe)>avg(si) then avg(fe) else avg(si) end ,mdate from table1 group by mdate当谁平均值大就显示谁,where条件你自己加^_^
select max(mfe) as mfe,max(msi) as msi from (SELECT avg(fe) as mfe,avg(si) as msi,mdate, and mdate BETWEEN :rq1 and :rq2 group by mdate)
select Max(mfe),max(msi) from ( SELECT avg(fe) as mfe,avg(si) as msi,mdate, and mdate BETWEEN :rq1 and :rq2 group by mdate ) 行不行阿
select Max(mfe),max(msi) from ( SELECT avg(fe) as mfe,avg(si) as msi,mdate, and mdate BETWEEN :rq1 and :rq2 group by mdate ) a 同意上面
select Max(mfe),max(msi) from ( SELECT avg(fe) as mfe,avg(si) as msi,mdate, and mdate BETWEEN :rq1 and :rq2 group by mdate ) a 同意上面,呵呵
SELECT avg(fe) as mfe,avg(si) as msi,mdate,...
into #temp
and mdate BETWEEN :rq1 and :rq2
group by mdateselect max(mfe) as mfe_max,max(msi) as msi_max from #temp
drop table #temp
into #temp
and mdate BETWEEN :rq1 and :rq2
group by mdateselect max(mfe) as mfe_max,max(msi) as msi_max from #temp
drop table #temp
from table1 group by mdate当谁平均值大就显示谁,where条件你自己加^_^
and mdate BETWEEN :rq1 and :rq2
group by mdate)
(
SELECT avg(fe) as mfe,avg(si) as msi,mdate,
and mdate BETWEEN :rq1 and :rq2
group by mdate
)
行不行阿
(
SELECT avg(fe) as mfe,avg(si) as msi,mdate,
and mdate BETWEEN :rq1 and :rq2
group by mdate
) a
同意上面
(
SELECT avg(fe) as mfe,avg(si) as msi,mdate,
and mdate BETWEEN :rq1 and :rq2
group by mdate
) a
同意上面,呵呵