Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multiply two SQL fields and SUM ?

Posted on 2006-11-30
1
Medium Priority
?
1,914 Views
Last Modified: 2012-06-21
Is it possible to multiple 2 SQL fields and then summarize them?

What I'm trying to do is calculate our top 100 spending customers. The fields I need to multiple are called qty * item_price.
Then I'm wanting to take those values and add up all the items by ID (which is the invoice ID ) and SUM them so that basically I can get a total value that each invoice has spent.

Is this  possible to write with SQL?
0
Comment
Question by:twentythree
[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
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 600 total points
ID: 18050628
Hi twentythree,
Yes you can do it


SELECT InvoiceID, SUM (Qty*Item_price) as tot
FROM urTable
GROUP BY InvoiceID

Cheers!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

618 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