Click here to Skip to main content
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 OriginalGriff 409
1 Sergey Alexandrovich Kryukov 339
2 Maciej Los 275
3 George Jonsson 185
4 PIEBALDconsult 175
0 Sergey Alexandrovich Kryukov 10,934
1 Maciej Los 5,614
2 OriginalGriff 5,603
3 CPallini 3,879
4 BillWoodruff 3,579


Advertise | Privacy | Mobile
Web01 | 2.8.141030.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2014
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