Solved

Syntax for: Average of  Field values

Posted on 2009-07-08
2
199 Views
Last Modified: 2012-05-07
Hi Experts

I have a client database, which holds records of client data including their purchase rates (ie transactions per year). Now I'd like to determine the average Purchase rate for the whole group of clients.

Can a sql be written to calculate the average??? ( or do i need to set up a loop, add each purchase rate and the divide by the nr of clients)

eg (VB6, Access 2003 database)
Client_Id     Client_PurchaseRate

sql = "Select distinct Client_ID from CLIENT_DETAILS "
?Sql .......determine average rate  ????

Set dsClients = CURDB.OpenRecordset (sql, dbOpenDynaset)

0
Comment
Question by:peterdarazs
2 Comments
 
LVL 17

Accepted Solution

by:
pssandhu earned 500 total points
ID: 24810946
Select ClientID, AVG(PurchaseRate) AvgRate
From   Client_Details
Group by CLientID
This is in MS Sql Server syntax.
P.
0
 

Author Closing Comment

by:peterdarazs
ID: 31601433
Ok, thanks , that 'll help a lot....
P
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question