query in SQL RRS feed

  • Question

  • User355715116 posted

    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?


    Thursday, June 18, 2020 3:06 PM


  • User355715116 posted

    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 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 18, 2020 3:56 PM