dbTalk Databases Forums  

Get Max Value AND Date it Occurred

comp.databases.ms-access comp.databases.ms-access


Discuss Get Max Value AND Date it Occurred in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gostroff@hydroqual.com
 
Posts: n/a

Default Get Max Value AND Date it Occurred - 12-17-2004 , 11:08 AM






Hi,

I have a lot of sample records done on different dates. It's easy to
get the maximum value for any sample parameter for any sample location,
but what if I want the date it was found?

For example, if I have a thousand locations and 20 parameters measured
at each loocation, and this sampling went on every day for a year, I
want to get the maximum value for each parameter at each location, AND
I want the data on which the maximum was found. Can I do that with one
SQL call? I can't get it.
I'm happy to write the query in SQL if need be.

Cheers,
Gary Ostroff


Reply With Quote
  #2  
Old   
Bas Cost Budde
 
Posts: n/a

Default Re: Get Max Value AND Date it Occurred - 12-17-2004 , 11:28 AM






gostroff (AT) hydroqual (DOT) com wrote:
Quote:
Hi,

I have a lot of sample records done on different dates. It's easy to
get the maximum value for any sample parameter for any sample location,
but what if I want the date it was found?

For example, if I have a thousand locations and 20 parameters measured
at each loocation, and this sampling went on every day for a year, I
want to get the maximum value for each parameter at each location, AND
I want the data on which the maximum was found. Can I do that with one
SQL call? I can't get it.
I'm happy to write the query in SQL if need be.
I certainly don't do this in one query. Anybody please teach me how.

Create a query that groups by parameter/location, and takes the max of
the date

Use this query in a join to the original table, linking location,
parameter name, and maxofdate, respectively, to location, parameter
name, and date -- of course --

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.