Results 1 to 3 of 3

Thread: Query Help

  1. #1
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267

    Unanswered: Query Help

    To All--

    I need a little help building a query in Access. I have a table that contains an Item Number, Event Description, and Event Time/Date. What I want to do is be able to see the last Event Time/Date and Event Description that happened to each Item Number.

    For instance:

    Item #111 might have an event at 17:00, 20:00, and 21:00.
    Item #222 might have an event at 18:00, 19:00, and 19:01.

    I want the query to return:

    Item #111 - 21:00
    Item #222 - 19:01

    I hope that makes sense. Thanks.

    C

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select [Item Number]
         , [Event Description]
         , [Event Time/Date]
      from daTable as T
     where [Event Time/Date] =
           ( select max([Event Time/Date])
               from daTable
              where [Item Number] = T.[Item Number] )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Thank you so much.

    C

Posting Permissions

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