解决方案 »

  1.   

    select * from AccountMark as b where not exists(select 1 from AccountMark where AccountId= b.AccountId
    and b.CreateTime<CreateTime )
      

  2.   

    参考下贴中的多种方法http://blog.csdn.net/acmain_chm/article/details/4126306
    [征集]分组取最大N条记录方法征集,及散分....
      

  3.   


    谢谢这位大神的解答,这样查出来的数据是正确的而且避免了查询子句的问题。但是如果我要在这里面统计出每一个AccountId有多少条Mark(最后一张截图里面的Num)该怎么写呢
      

  4.   

    select *,(select count(distinct ) from AccountMark where AccountId= b.AccountId)
     from AccountMark as b where not exists(select 1 from AccountMark where AccountId= b.AccountId
     and b.CreateTime<CreateTime )
      

  5.   

    谢谢,方法很多,受教了。但是我这里该怎么统计出一个AccountId有多少条数据呢?