首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求一短小精罕,性能坡加的sql语句解决方案

2012-03-19 
求一短小精罕,性能坡加的sql语句employeeidserviceDate12004-01-0112008-01-0112006-01-0122004-02-012200

求一短小精罕,性能坡加的sql语句
employeeid         serviceDate
1                           2004-01-01
1                           2008-01-01
1                           2006-01-01      
2                           2004-02-01
2                           2006-02-01
2                           2007-02-01

需要这个结果
employeeid         serviceDate
1                           2008-01-01
2                           2007-02-01


[解决办法]
select employeeid,max(serviceDate) as serviceDate
from tablename
group by employeeid

热点排行