Solved

Use of MAX function in MS Access Query

Posted on 2010-11-18
3
330 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to send multiple emails at the same time in PHP 12 58
Oracle SQL - Query help 7 54
SQL Server 2012 rs - Field1 and Field2 add 1 to Total 4 18
SQL Error - Query 6 25
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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