?
Solved

Syntax for: Average of  Field values

Posted on 2009-07-08
2
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
pssandhu earned 2000 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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