Solved

Syntax for: Average of  Field values

Posted on 2009-07-08
2
205 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 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

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…
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

737 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