select sum(表.产量)
 from 表,(select 工作面编号,max(工作日期) 工作日期 from 表) t
 where 表.工作面编号=t.工作面编号 and 表.工作日期=t.工作日期

解决方案 »

  1.   

    select sum(float) from tab_name where 工作日期 in (select max(工作日期) from tab_name group by 工作面编号)
      

  2.   

    select 总和=sum(产量)
    from tab_name a join(
    select 工作面编号,工作日期=max(工作日期)
    from tab_name
    group by 工作面编号
    )b on a.工作面编号=b.工作面编号 and a.工作日期=b.工作日期
      

  3.   

    mssql版有邹建大哥没有解决不了的问题
      

  4.   

    select sum(產量) as 總產量
    from tab_name
    where 工作日期 in(select max(工作日期) from tab_name group by 工作面編號)
      

  5.   

    select sum(a.产量) from table a,(select 工作编号,max(工作日期) 工作日期  from table ) b where a.工作日期=b.工作日期
      

  6.   

    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.工作日期
                      )