Click here to Skip to main content
11,505,486 members (35,824 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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:24pm
Comments
Sergey Alexandrovich Kryukov at 9-Feb-13 13:35pm
   
What did you try so far?
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

SELECT empid, MAX(startdate) AS MaxStartDate
FROM employementhistory
GROUP BY empid 
  Permalink  
Comments
Maciej Los at 14-Feb-13 15:49pm
   
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
0 Sergey Alexandrovich Kryukov 532
1 F-ES Sitecore 380
2 Richard Deeming 270
3 CHill60 245
4 Richard MacCutchan 230
0 Sergey Alexandrovich Kryukov 1,087
1 Maciej Los 625
2 Peter Leow 540
3 F-ES Sitecore 525
4 OriginalGriff 487


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100