select * 
from 表 a join (select 物品, max(日期) as 日期 from 表 group by 物品) b
where a.物品 = b.物品 and a.日期 = b.日期

解决方案 »

  1.   

    select  物品 ,max(日期) from  table where group by  物品
      

  2.   

    select * from table group by 物品 order by 日期 desc
      

  3.   

    select  物品 ,max(日期) as 日期 from  table where group by  物品
      

  4.   

    select a.* 
    from #table a join (select 物品, max(日期) as 日期 from #table group by 物品) b
    on a.物品 = b.物品 and a.日期 = b.日期
    order by a.物品
      

  5.   

    select  物品 ,max(日期) as 日期 from  table where group by  物品
      

  6.   

    select  物品 ,max(日期) as 日期 from  table where group by  物品 order by 物品
      

  7.   

    select * 
    from 表 a join (select 物品, max(日期) as 日期 from 表 group by 物品) b
    on a.物品 = b.物品 and a.日期 = b.日期或者
    select * 
    from 表 a ,(select 物品, max(日期) as 日期 from 表 group by 物品) b
    where a.物品 = b.物品 and a.日期 = b.日期
      

  8.   

    lengxiaowei(小伟) 
    你的意思好像是这样的:
    select top 1 * from table group by 物品 order by 日期 desc是不是?
      

  9.   

    select * from table6
    where 日期 in
    (select max(日期) from table6
    group by 物品)