Results 1 to 3 of 3
  1. #1
    Ira is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2011
    Location
    South Florida
    Posts
    21

    Ms access sql query to return last 2 purchase records by partno

    I have an Access Table with

    PartNo, PurchaseDate

    33, 1/1/2018
    66, 11/1/2021
    33, 12/1/2020
    66, 6/7/2020
    33, 8/9/2021
    66, 1/1/2007
    33, 3/1/2019
    33, 1/1/2020
    66, 4/11/2020
    33, 1/1/2011
    22, 3/1/2020
    22, 6/1/2020
    22, 1/1/2020
    33, 1/7/2018
    66, 1/1/2020
    33, 5/1/2016


    33, 9/1/2007

    Just trying to develop a query to return the LAST 2 purchases (Most recent first) for EACH PartNo

    Thank you, Ira

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Please review the Top N by Group here:
    http://allenbrowne.com/subquery-01.html

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    top 2, sort descending date

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 24
    Last Post: 09-16-2018, 04:02 PM
  2. Replies: 5
    Last Post: 12-01-2015, 03:09 PM
  3. Replies: 9
    Last Post: 08-19-2014, 12:41 PM
  4. Access not return the records
    By ashutoshNetsity in forum Access
    Replies: 1
    Last Post: 05-09-2010, 04:27 AM
  5. Return all records from Query
    By ysrini in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 09:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums