Max Function

rykid16

Registered User.
Local time
Today, 10:58
Joined
Jul 21, 2015
Messages
20
How do I use the Max() function to get only one number. And also what do I put in the parentheses?
 
Following my advice from before, have a look at the following link that discusses using a Totals Query:
https://support.office.com/en-za/ar...-a-query-430a669b-e7fd-4c4b-b154-8c8dbbe41c8a

... only include the field that you would like to get the max of, click the sigma button, under the Totals row select Max, then run the query. To retrieve the value in your form, use the DLookup() function.

The other one I mentioned was DMax(), have a look here:
https://support.office.com/en-za/ar...-a-query-430a669b-e7fd-4c4b-b154-8c8dbbe41c8a
 
say if I had 20 numbers. How will I pull only the highest one and only have that one show up on the query?
 
Have you read through the links posted? I also explained how you would do it in my last post.
 
I have and when I run the query it shows up empty.
 
Let me see the SQL of the query you tried.

And a bit of advice, in a forum such as this, when you're presented with solutions/suggestions, give it a try and if you're having difficulty show us what you've tried and we'll advice.
 
SELECT Players.[First Name], Players.[Last Name], Players.City, Players.[Team Name], Players.Position, Max(Players.[Year Drafted]) AS [MaxOfYear Drafted], Players.[Jersey Number]
FROM Players
GROUP BY Players.[First Name], Players.[Last Name], Players.City, Players.[Team Name], Players.Position, Players.[Jersey Number]
HAVING (((Max(Players.[Year Drafted]))=Max("Year Drafted")));
 
You want just the max value so:
Code:
SELECT Max(Players.[Year Drafted]) AS [MaxOfYear Drafted]
FROM Players;
 
OKay thanks but now I want to print that specific players name and information with it.
 
Add/drop the above query to a SELECT query that includes all the player fields, then join the table and the above query via the [MaxOfYear Drafted] and the [Year Drafted] fields.
 
SELECT Players.[First Name], Players.[Last Name], Players.City, Players.[Team Name], Players.Position, Players.[Jersey Number], [PLayers Query].[MaxOfYear Drafted]
FROM Players, [PLayers Query];
 
And what does the above mean? Can you please back up your posts with some explanation.
 
I am using two queries.
IN the place on the bottom do I put all of the fields?
 
that SQL code was off of a new query. PLayers Query is the one with the max year.
 
It also says missing operator in Max[Year Drafted].
 
Two queries with a join... remember I mentioned joining...
 

Users who are viewing this thread

Back
Top Bottom