Access query to return a list of customers (Distict) with their most recent transaction date

I need to contruct a query that returns just one record for each customer (that has made a purchase) with the date of their last purchase.

So I have a transaction table with the customer ID so from this table I need to return just the most recent instance of each Customer ID along with the transaction date. I'll then join this to the customer table to get names and stuff.

The query is used for a report which then filters the date range of the transactions.

What is the fastest method to return this data set?
kentgorrellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fridomCEO/ProgrammerCommented:
Well the best is to keep some date with the  entries. Have you done that?

if not do you have some autowert value field in the table? If yes just use  e.g
DMax([autoIdField]); ....
0
kentgorrellAuthor Commented:
As I said, the Transaction table has Customer_ID and Transaction_Date.

To clarify, I want a list that includes just one record for each customer - the most recent.

of course if I don't include the date then SELECT DISTINCT will work but I do need the date and it must be the most recent.

I can work the join to the customer table out myself I just need the SQL for the Transation Table to return just the most recent record for each customer.
0
VipulKadiaCommented:
Following is a MS-SQL query :
Select Customer_ID, MAX(Transaction_Date) FROM YourTable GROUP BY Customer_ID
0
fridomCEO/ProgrammerCommented:
Then you can use Dmax on the Transaction date or the MAX SQL function on the Transaction Date.
SELECT CustomerData.CustomerID, Max([LastModified]) AS LastDate
FROM CustomerData
Group by CustomerID;


Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.