Results 1 to 2 of 2
  1. #1
    htmlasp is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2014
    Posts
    3

    Stupid Question - Using "LAST" in query


    I have a table with 4 fields

    PaymentID(autonumber PK) / PaymentPayer / PaymentDate / PaymentAmount

    I want to do a LAST of query on PaymentDate to find the last payment date for each customer

    When I set LAST under totals in the query on the Pay mentDate field it returns every row as if LAST is not even set

    If I have John Smith paid on 4/2/14 and 4/15/14 I only want to show the 4/15 payment for John Smith.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Don't use Last.
    You need to find the latest PaymentDate for each PaymentPayer
    Code:
    SELECT
    PaymentID
    ,PaymentPayer 
    ,PaymentDate 
    ,PaymentAmount
    FROM YourTable
    WHERE
    PaymentD,ate = (SELECT Max(PaymentDate) from YourTable as X
                           WHERE X.PaymentPayer = PaymnetPayer)
    Good luck with your project.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-03-2014, 09:35 AM
  2. Replies: 6
    Last Post: 06-07-2013, 09:45 AM
  3. Replies: 4
    Last Post: 01-03-2013, 03:50 PM
  4. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  5. Replies: 1
    Last Post: 08-23-2012, 08:32 AM

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