Last post Jun 18, 2020 03:56 PM by mazharul007
Jun 18, 2020 03:06 PM|mazharul007|LINK
I have an applicantID. And, I have a table called WorkHistory in my database. This table includes columns named 'isContinuing', 'positionID', 'createdDate'. Now, I want
to run a query into the 'WorkHistory' table using my applicantID. Regarding conditions are:
'isContinuing' = 1 (where 'createdDate' value is maximum).
And want to get 'positionID' based on above condition.
And, I have another table named 'Position' in my database. I want to extract the 'PositionName from the 'Position' table using the value of 'positionID'.
How can I do this in a single query?
Jun 18, 2020 03:56 PM|mazharul007|LINK
SELECT top 1 p.PositionName FROM ApplicantWorkHistory ah
INNER JOIN Position as p ON ah.PositionID = p.PositionID WHERE ah.IsContinuing=1 AND ah.ApplicantID = 149830
order by ah.CreatedDate desc
This one worked for me