select top 1 .......group by mobile_id

解决方案 »

  1.   

    select * 
    from yourtable t1 
    where creat_time = (select max(creat_time) from yourtable t2 
                         where t1.mobile_id = t2.mobile_id)
      

  2.   

    select * 
    from yourtable t1 
    where creat_time = (select max(creat_time) from yourtable t2 
                         where t1.mobile_id = t2.mobile_id)
      

  3.   

    SELECT b.mobile_id,
              (SELECT TOP 1 a.creat_time
             FROM mobile a
             WHERE a.mobile_id = b.mobile_id
             ORDER BY a.creat_time DESC) AS lasttime
    FROM mobile b
    GROUP BY b.mobile_id
      

  4.   

    select * from YourTable 
    where creat_time in (select max(creat_time) from YourTable group by mobile_id)
      

  5.   

    同意saucer
    select * from Tabel1 a where creat_time in (
    select max(creat_time) from Table1 b where a.mobile_id=b.mobile_id) order by a.mobile_id
      

  6.   

    select * from mobiletable a where create_time =(select max(create_time) from mobiletable b where a.mobile_id = b.mobile_id group by mobile_id)应该会没问题,我写过类似的
      

  7.   

    思归的方法可行,我试验过。正如allanli(若尘) 所说