select peoid,max(date) from tbl group by peoid

解决方案 »

  1.   

    select * from tb a where not exists (select 1 from tb where Peoid=a.Peoid
                                         and Date>a.Date)
      

  2.   

    在 Northwind
    这两个语句返回的行数不一样select CustomerID,max(OrderDate) from orders group by CustomerIDselect * from orders a where not exists(select 1 from orders where CustomerID=a.CustomerID and OrderDate>a.OrderDate)
    order by CustomerID
      

  3.   

    select peoid,max(date) from 表 group by peoid
      

  4.   

    select peoid,max(date) from 表 group by peoid
      

  5.   

    select peoid,max(date) from 表 group by peoid
      

  6.   

    select * from tb a where  (select  count(1) from tb where Peoid=a.Peoid
                                         and Date>=a.Date)<1
      

  7.   

    select a.* 
    from table a,
         (select PeoID,Max(date) as date 
          from table
          group by PeoID
         ) b
    where a.PeoID = b.PeoID 
      and a.date = b.date
    order by a.id
      

  8.   

    SELECT PeoID,max(date) as date from table group by PeoID
      

  9.   

    回复人: EastboyEastboy(鬼谷游侠) ( ) 信誉:100  2005-02-18 14:17:00  得分: 0  
     
     
       select a.* 
    from table a,
         (select PeoID,Max(date) as date 
          from table
          group by PeoID
         ) b
    where a.PeoID = b.PeoID 
      and a.date = b.date
    order by a.id
      
     上述應該才是樓主要的!!!!!