Solved

Query to select last record

Posted on 2008-06-11
3
1,605 Views
Last Modified: 2012-05-05
I have an access database that contains a table (table is Transactions_tbl) for all transactions for all customers.  I need to run a query that will pull only the most recent transaction (field is Transact_Date) for every customer  (field is Customer_ID) in the table.
0
Comment
Question by:sharringtoncpa
  • 2
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 21763526

select *
from Transactions_tbl
where Transact_Date in (select max(Transact_Date) from Transactions_tbl as T  where T.Customer_ID=Transactions_tbl.Customer_ID
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 21763530
select *
from Transactions_tbl
where Transact_Date in (select max(Transact_Date) from Transactions_tbl as T  where T.Customer_ID=Transactions_tbl.Customer_ID)
0
 

Author Closing Comment

by:sharringtoncpa
ID: 31466309
Thanks capricorn1.  Your solution will save me a lot of time.  Thanks again.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question