HawaiiDragon
asked on
Doing a count and sum in SQL query
Hello all,
I of course am having problems with something that I am sure is simple as heck. I have my qurey ahat returns vendor names and payments from a table now I have come to the hard part. I need the totals of the payments based off of vendors in the payment sum collum. ie company A has paid 10 , 2 , 5 so the result would say Company A 17
Thank you for your assistance
I of course am having problems with something that I am sure is simple as heck. I have my qurey ahat returns vendor names and payments from a table now I have come to the hard part. I need the totals of the payments based off of vendors in the payment sum collum. ie company A has paid 10 , 2 , 5 so the result would say Company A 17
Thank you for your assistance
SELECT TOP (10) Vendors.VendorName, Invoices.PaymentTotal As PaymentSum
FROM Invoices INNER JOIN
Vendors ON Invoices.VendorID = Vendors.VendorID
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help you :)
Raj
Raj
ASKER
SELECT TOP (10) Vendors.VendorName,
SUM(Invoices.PaymentTotal)
FROM Invoices INNER JOIN
Vendors ON Invoices.VendorID = Vendors.VendorID
GROUP BY Vendors.VendorName
Order by PaymentSum DESC