View Full Version : Query Problem


rchanl
09-11-2001, 07:51 AM
I am having a problem getting my query to produce the response I need.

Background:
I have a database that has sales for individuals for multiple dates.

Desired Result:
I want the query to be able to tell me what individuals had the highest sales for each date over a period of time(the parameter query for date range is already set)

Any suggestions?

jwindon
09-11-2001, 08:31 AM
Use the Max() function.

rchanl
09-11-2001, 10:08 AM
I've tried using the Max() function, but could not get it to work properly. How are you proposing to write the query?

Pat Hartman
09-11-2001, 11:10 AM
If you are looking for the max value of an individual sale, you need to use the Max() function. If you want the largest amount for each day, you need to start with a totals query that summarizes the sales amounts by day and sales person. Then a query that takes the totals query and finds the Max() value for each day. Finally a query that takes the results of the Max() query and joins it back to the totals query to retrieve the salespersonId.