Solved

Use of MAX function in MS Access Query

Posted on 2010-11-18
3
328 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
Comment Utility
See the screenshot attached for the Design View.

Sincerely,
Ed
Max.JPG
0
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

7 Experts available now in Live!

Get 1:1 Help Now