Query distinct value?

  • Hi experts,

    I want to display the opening job postings in Chicago area, if there's same job titles, only display the latest one.

    The query I have is listing all opening jobs in Chicago area, and I am trying to have the distinct value on Job_Title which Job_Posting_Date is the latest date, HOW TO DO THAT?

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

    The result from my query:

    Job_Locale   Job_Posting_Date    Job_Title

    IL-Chicago   10/26/2004             Assistant Manager

                     5/25/2005               District Manager

                     5/25/2005               District Manager

                     9/28/2005               District Manager

    The result I want:

    Job_Locale    Job_Posting_Date    Job_Title

    IL-Chicago    10/26/2004            Assistant Manager

                       9/28/2005             District Manager

      

      

    The query I have:

    SELECT Job_Locale,Job_Posting_Date,Job_Title

    FROM Job_Posting_Table

    where Job_Posting_Status='Open' and Job_Code between 3 and 5 and Job_Area='Chicago'

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

    Thank you.

  • Select Job_Locale, MAX(Job_Posting_Date) AS Job_Posting_Date, Job_Title from dbo.Job_Posting_Table

    where Job_Posting_Status='Open' and Job_Code between 3 and 5 and Job_Area='Chicago'

    group by Job_Locale, Job_Title

  • On another note, are you suffixing all your table names with _table???

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

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