Selecting the latest records, GROUP BY

  • I have a single table with three columns as follows:

    DEPT_ID     DEPT_NAME          DATE_STAMP

    -----------------------------------------

    11450       Sales              10/01/2001

    11450       Sales Divsion      10/30/2002

    11450       Sales Dept.        10/30/2003

    11550       Computer Dept      11/20/2002

    11550       IT Division        12/31/2003

    11600       Payroll Dept       06/30/2003

    11600       Human Resources    07/15/2004

    How can I write a single select statement to bring back the department (and its associated name) with the latest date stamp?  My result set should appear as follows:

    11450       Sales Dept.        10/30/2003

    11550       IT Division        12/31/2003

    11600       Human Resources    07/15/2004

    Thanks!

  • John,

    I have answered your question in the T-SQL Forum. No need to post the question twice!


    Kindest Regards,

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply