Click here to Skip to main content
Sign Up to vote bad
good
See more: SQL-Server
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
Posted 8 Feb '13 - 23:24

Comments
Sergey Alexandrovich Kryukov - 9 Feb '13 - 13:35
What did you try so far? —SA
arnavs - 14 Feb '13 - 21:42
Atleast try once and then post your problem here.

1 solution

SELECT empid, MAX(startdate) AS MaxStartDate
FROM employementhistory
GROUP BY empid 
  Permalink  
Comments
Maciej Los - 14 Feb '13 - 15:49
Good work, +5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 178
1 Tadit Dash 144
2 Santhosh G_ 140
3 Sergey Alexandrovich Kryukov 134
4 Espen Harlinn 120
0 Sergey Alexandrovich Kryukov 10,348
1 OriginalGriff 7,965
2 CPallini 4,241
3 Rohan Leuva 3,522
4 Maciej Los 3,184


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid