本帖最后由 xiaocainiao_2010 于 2010-07-19 10:36:28 编辑

解决方案 »

  1.   

    select * from tb a where 
    not exists(select 1 from tb where 产品id=a.产品id and 时间>a.时间)
      

  2.   

    select *
    from a t
    where not exists(select 1
                     from a 
                     where 用户=t.用户 and  消费时间>t.消费时间)
      

  3.   

    select *
    from a k
    where not exists(select * from a where k.产品ID=产品ID and 消费时间>k.消费时间)
      

  4.   

    select * from tb a where 
    时间=(select max(时间) from tb where 产品id=a.产品id )
      

  5.   

    select * from a t where (select count(*) from a where id=t.id and t.消费日期>消费日期)<1