how to sort oldest dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pkh5695
    New Member
    • Jun 2010
    • 1

    #1

    how to sort oldest dates

    hey everyone,
    i am having trouble with getting this to work, i have an inventory table with part number, description, qty, location where it stocked and date it came in, and how much has shipped, and a couple of other things, i have successful made a query that tells me when a primary location is low on stock, but i would like to make a query that will then look thru the other locations that same part is in and return the oldest date or the oldest 2 dates, so i know where to go and get the new product and refill the location. it does not sound hard but i have not been able to get it.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    Why not sort by the stock date, so the first row is the row you want? Oh, wait, the post title indicates you already thought of that ... there is a sorting option on the query builder. You can choose ascending or descending. But you probably tried that already ... what was the result of that?

    Jim

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      It sounds like you want a linked subquery (See Subqueries in SQL) which uses the TOP predicate and sorts ascending by date.

      It's hard to be precise without more info related to the table you wish to search.

      Welcome to Bytes!

      Comment

      • jimatqsi
        Moderator Top Contributor
        • Oct 2006
        • 1293

        #4
        I didn't know about subqueries! 10 years in Access and I didn't know about them. Thank you Ade, thank you Bytes.com!

        Jim

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          Well, I must say I'm very pleased to have been an instrument of enlightenment :) Good for you Jim.

          Comment

          Working...