Basicfarmer
asked on
Need assistance with SQL Query
I need a query to return the totals for the items of a project. The ProjectItems table has the following columns.
ID
ProjectID
Qty
Cost
List
Discount
So I need it to return Total Cost, List Price and Sell Price.
Total Cost would be the sum of (Qty * Cost) in each row
List Price would be the sum of (Qty * List) in each row
Sell Price would be the sum of ((1 - Discount) * (Qty * List)) in each row
ID
ProjectID
Qty
Cost
List
Discount
So I need it to return Total Cost, List Price and Sell Price.
Total Cost would be the sum of (Qty * Cost) in each row
List Price would be the sum of (Qty * List) in each row
Sell Price would be the sum of ((1 - Discount) * (Qty * List)) in each row
ASKER
Yes, that will give me the Totals for each row, but what I need is the Sum of the rows based on those calculations.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys, I was stuck on the Group By. That is exactly what I needed.
Open in new window