如何在一个表的每个员工中获得max startdate [英] How to get max startdate in each employee of one table

查看:71
本文介绍了如何在一个表的每个员工中获得max startdate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在此表中有员工历史表empid,jobtitle,startdate,enddate列在那里。
每个
员工每次选择开始日期和结束日期时都可以输入不止一次的工作时间。但是我的要求是我希望每位员工获得最大的开始日期。假设我有20名员工所以

我希望得到20个职位。请告诉我任何一个。



谢谢

解决方案

  SELECT  empid,MAX(startdate) AS  MaxStartDate 
FROM employementhistory
GROUP BY empid


Hello all,

I have employeement history table in this table empid, jobtitle, startdate, enddate columns are there.
each employee can enter more than one time his jobtile each time he select startdate and enddate
but my requirement is i want to get max startdate jobtile in each employee. suppose i have 20 employees so
i want to get 20 jobtitles. Please tell me any one.

Thanks

解决方案

SELECT empid, MAX(startdate) AS MaxStartDate
FROM employementhistory
GROUP BY empid 


这篇关于如何在一个表的每个员工中获得max startdate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆