get average value based on different dates

vojinb

Registered User.
Local time
Today, 13:53
Joined
Jul 25, 2011
Messages
38
Hi,
I have table consisting next rows:

account1 value1 date1
account2 value1 date1
account3 value 1 date 1

account1 value2 date2
account2 value2 date2
account3 value 2 date 2

account1 value3 date3
account2 value3 date3
account3 value 3 date 3

How to get average values for each account ( including all dates),so if for account1 and date1 value was 25000, for date2 23000,date3 14000,and average was 20666, I get sub-form showing this average values for all dates like:

account1 avg(value)
account2 avg(value)
account3 avg(value)
?
 
Does this query work?

SELECT Account, Avg(Amount) As AvgAmount
FROM TableName
GROUP BY Account
 
Hi,
It's not working, gives me an error:
" You tried to execute query that does not include
the specified expresion 'account' as part of an aggregate function"
 
Hi,
I manage to solve it with using :
"Select distinctrow" instead of just "Select"
Thanks :))
 
You must have missed the GROUP BY clause to get that error.
 

Users who are viewing this thread

Back
Top Bottom