select 零件名称,max(采购日期) from 表 group by 零件名称

解决方案 »

  1.   

    select * from 表 a
    where 采购日期 = ( select top 1 采购日期 from 表 where 零件名称 = a.零件名称 order by 采购日期 desc )
      

  2.   

    select 零件名称,采购价格 from 表 where 采购日期 in(select max(采购日期) from 表 group by 零件名称)
      

  3.   


    select a.零件名称,a.采购价格 
    from tablename a join
         (  select 零件名称, max(采购日期) as 日期
            from tablename
            group by 零件名称
         ) b on a.零件名称=b.零件名称 and a.采购日期=b.日期