Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Aggregate function non-grouped field (Using Access)


Message #1 by "Garett Raines" <gtraines@y...> on Thu, 2 May 2002 13:36:46
Try:

Select ExchgRate, C.CurrencyID, C.Datefield
From CurrencyTable C
Join (Select CurrencyID, Max(Datefield)  as Datefield From CurrencyTable
Group By CurrencyID) T
On C.CurrencyID=T.CurrencyID and C.Datefield=T.Datefield

Gary

-----Original Message-----
From: Garett Raines [mailto:gtraines@y...]
Sent: Thursday, May 02, 2002 7:36 AM
To: sql language
Subject: [sql_language] RE: Aggregate function non-grouped field (Using
Access)


> To include the exchange rate field, you'll need to apply one of the 
aggregate functions to it as well - MAX(ExchgRate), MIN(ExchgRate)... 
etc. depending on what value you want to see.

I was afraid of that. This is probably a silly question, but is there an 
aggregate function I can apply to the Exchange Rate without affecting the 
query results? I've experimented a bit, and each of these functions have 
altered the query results so that the value returned is no longer 
necessarily the most recent. The problem is that I don't want Exchange 
Rate considered at all in the query, but without having the Exchange Rate 
returned the query does me no good...



  Return to Index