Advertisement

06.26.2008 at 03:15AM PDT, ID: 23517550
[x]
Attachment Details

SQL to multiply values on each row and then find the average

Asked by ihatelag in MS SQL Server, SQL Server 2005

Tags: ,

Hi there,

I have a table Customer with the following details

AcctID,  Name, Ticket, Values

1            Bob       3           20
2            Bob       3           10
3           Bob        4            5
4           Bob        5          10
5           Bob        5          10
6           Karen     6           2

What I need to do is write a SQL query to multiply the values together for each ticket and then return the Average Value per user(Name). - The Average Value is the multiplied values for each ticket divided by the number of tickets.

Please can you help me write the SQL query to return the average values per user.

Many thanks. Start Free Trial
 
 
[+][-]06.26.2008 at 03:27AM PDT, ID: 21873274

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 07:09AM PDT, ID: 21874960

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 07:21AM PDT, ID: 21875090

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Server 2005
Tags: SQL, SQL Server 2005
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628