Solved

Use of MAX function in MS Access Query

Posted on 2010-11-18
3
329 Views
Last Modified: 2012-05-10
I have an MS Access table that contains two columns that looks something like :

Field A        Field B
Houses       1
Houses       2
Houses       3
Houses       4
Houses       5
Flats            1
Flats             2
Flats             3
Flats             4
Bungalows   1
Bungalows   2
Bungalows   3

I want to run a query that returns only the rows where the highest number in Field B relates to Houses, Flats, or Bungalows.  i.e. the query will return 3 rows which will contain Version 5, 4 and 3 respectively.  My real data contains an inconsistent number of versions for each category, and I just want the 'Max' (highest number) in each case and return a single row

How do I create my query please?  I would like this in Design View syntax not SQL please
0
Comment
Question by:MPWOOD
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 500 total points
ID: 34163510
See the screenshot attached for the Design View.

Sincerely,
Ed
Max.JPG
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34163526
Here's the SQL Statement:

SELECT Table4.FieldA, Max(Table4.FieldB) AS MaxOfFieldB1
FROM Table4
GROUP BY Table4.FieldA;

And see screenshot when you run Query 3.

Sincerely,
Ed
Display.JPG
0
 

Author Closing Comment

by:MPWOOD
ID: 34163569
yes, it was so simple in the end !  I am so rusty on Access, I should've known that!  Thanks for your quick help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle query output question 4 36
Oracle Pivot Question 8 45
SQL Query 34 82
What query can i write to find where a function is 4 22
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now