select sum(float) from tab_name where 工作日期 in (select max(工作日期) from tab_name group by 工作面编号)
select 总和=sum(产量) from tab_name a join( select 工作面编号,工作日期=max(工作日期) from tab_name group by 工作面编号 )b on a.工作面编号=b.工作面编号 and a.工作日期=b.工作日期
mssql版有邹建大哥没有解决不了的问题
select sum(產量) as 總產量 from tab_name where 工作日期 in(select max(工作日期) from tab_name group by 工作面編號)
select sum(a.产量) from table a,(select 工作编号,max(工作日期) 工作日期 from table ) b where a.工作日期=b.工作日期
select sum(产量) from tab_name a where 工作日期 = (select max(工作日期) from tab_name where 工作面编号 = a.工作面编号) select sum(产量) from tab_name a where not exists (select 1 from tab_name where 工作面编号 = a.工作面编号 and 工作日期 >= a.工作日期 )
from tab_name a join(
select 工作面编号,工作日期=max(工作日期)
from tab_name
group by 工作面编号
)b on a.工作面编号=b.工作面编号 and a.工作日期=b.工作日期
from tab_name
where 工作日期 in(select max(工作日期) from tab_name group by 工作面編號)
from tab_name a
where 工作日期 = (select max(工作日期)
from tab_name
where 工作面编号 = a.工作面编号)
select sum(产量)
from tab_name a
where not exists (select 1
from tab_name
where 工作面编号 = a.工作面编号
and 工作日期 >= a.工作日期
)