select 客户号,max(业务日期),
(select top 1 业务员 from table b where b.客户号 = a.客户号 order by 业务日期 desc )
from table a
group by 客户号

解决方案 »

  1.   

    TO: windindance(风舞轻扬)   我现在只有一个表啊,你SQL中的table a和table b是指什么,我只看懂了一半~ 再次求教~
      

  2.   

    select 客户号,max(业务日期),
    (select top 1 业务员 from table b where b.客户号 = a.客户号 order by 业务日期 desc )
    from table a
    group by 客户号
    //b 是别名,table是表名
      

  3.   

    select 客户号,max(业务日期),
    (select top 1 业务员 from table b where b.客户号 = a.客户号 order by 业务日期 desc )
    from table a
    group by 客户号
    //a和b 是别名,table是表名