Solved

Create query to show only most recent date for part numbers/transaction types

Posted on 2014-01-02
2
1,440 Views
Last Modified: 2014-01-02
I have a table with 3 fields;

ITEM_ID, TRANSACTION_DATE, TRANSACTION_TYPE

The table has about a half a million records and I want to filter it out to show me only the most recent date (1 record) for each TRANSACTION_TYPE (There is 4 different transaction types) for each ITEM_ID.

Is there a way to do this easily in an Access Query?

Thanks in advance!
Dan
0
Comment
Question by:filtrationproducts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 200 total points
ID: 39751303
> show me only the most recent date (1 record) for each TRANSACTION_TYPE  for each ITEM_ID.
Create a new query, then go into SQL View, then copy-paste the below SQL into that SQL view, then rename YOUR_TABLE.
SELECT ITEM_ID, TRANSACTION_TYPE, Max(TRANSACTION_DATE) as most_recent_date
FROM YOUR_TABLE
GROUP BY ITEM_ID, TRANSACTION_TYPE
ORDER BY ITEM_ID, TRANSACTION_TYPE

Open in new window

0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39751353
SELECT Item_ID, TransAction_Type, MAX(Transaction_Date) as MaxDate
FROM youTable
GROUP BY ItemID, Transaction_Type
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

734 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