Queries that compare data in a table???

  • I need to compare data in a table and I don't know how to do this.

    I have a table with an employee number, code, and number of hours.

    I need a query that will give me the employee number, code, and number of hours from the table, but if the employee is in the table twice...I only need the record with lower number of hours. (some employee are in the table twice with different amount of hours)

  • Oops, my bad.  That will not work.  Will your Code values be the same for the employees and only the hours different?  If so use

    SELECT Empoyee#, Code, MIN(Hours) FROM YourTable GROUP BY Employee#, Code

    If not, how do you want to handle those differences?

     

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • that was simple...thank you much

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

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