Results 1 to 2 of 2

Thread: Query problem

  1. #1
    New Lounger
    Join Date
    May 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This has to be something that is done very commonly in databases but has me stumped.

    I have a table with 4 fields, ID, EmployeeID, Date, Status

    I need to find the current status of all employees.

    Could someone help?

    Thanks

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Presumably the current status is the one with the latest (i.e. largest date) ?

    I would do it in 2 stages.
    • first query find the max date when grouped by EmployeeID.
    • 2nd query joins the first query back to the table, joining on the date field and the employee ID field. This query can then show the status.
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •