select * from A t
where Cdate in (select distinct top 2 Cdate 
                   from A 
                       where Cid=t.Cid 
                          order by Cdate desc)

解决方案 »

  1.   

    select * from a t where cid in(select top 2 cid from a where cid=t.cid order by cdate desc)
      

  2.   

    如果我的表A是一条sql语句怎么办,比如是select a.Cid,b.Cdate from 表 a,表 b
    那该怎么办?楼上两位再帮我想想办法.
      

  3.   

    回复人: lxzm1001(*蓝星之梦*) ( ) 信誉:100  2005-10-11 9:57:34  得分: 5  
     
     
       
    select * from a t where cid in(select top 2 cid from a where cid=t.cid order by cdate desc)  
     
    --写错勒,我试过