select id,max(id2) as id2,max(item1) as item1 group by id

解决方案 »

  1.   

    select id,id2=max(id2),item1=(select item1 from 表表1 b 
                                  where a.id = b.id and max(a.id)= b.id)
    from 表表1 a 
    group by id
      

  2.   

    跟我的问题类似呢!:)http://expert.csdn.net/Expert/topic/1251/1251173.xml?temp=.1300623
      

  3.   

    或者:
    select * 
    from 表表1 a,
        (select id,id2=max(id2) from 表表1 group by id) as b
    where a.id = b.id and a.id2 = b.id2
      

  4.   

    我已经解决了。http://expert.csdn.net/Expert/topic/1251/1251173.xml?temp=.1300623
      

  5.   

    呵呵,再来一遍select a.* from  表一 a, (select id , max(id2) id2 from 表一 group by id ) b where a.id= b.id and a.id2= b.id2