Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing

Status
Not open for further replies.

RWahlert

MIS
May 17, 2004
51
US
I'm trying to create a sum of all the values returned in a column, i.e. I want to add up all the values of the column quantity. For some, no pun intended, reason this is driving me to fits.

This is my select statement:

select E.ItemCode, E.Dscription, E.Price, A.U_CardCode, A.U_DocNum, B.U_BaseType, b.u_qtyship
from RDR1 E inner join [@sh_shr1] b on e.DocEntry = b.U_BaseDoc and e.linenum = b.U_Baserow inner join [@sh_oshr] a on b.U_DocNum = a.U_DocNum
where E.DocEntry = 4

I want to add up the values in the column u_qtyship or even better, get the sume of b.u_qtyship * e.price

Any advise would be greatly appreciated.
 
Is this what you were looking for?

Code:
SELECT SUM(u_qtyship * price) AS ExtPrice
FROM

(select E.ItemCode, E.Dscription, E.Price, A.U_CardCode, A.U_DocNum, B.U_BaseType, b.u_qtyship
from RDR1 E inner join [@sh_shr1] b on e.DocEntry = b.U_BaseDoc and e.linenum = b.U_Baserow inner join [@sh_oshr] a on b.U_DocNum = a.U_DocNum
where E.DocEntry = 4) c
 
This gives me a great place to work from.

Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top