October 15, 2011 at 9:46 am
select c.customerid,c.firstname,c.lastname,o.totalprice
from Test_Customer1 c
inner join (select customerid,SUM(price) as totalprice
from test_orders group by customerid) o
on c.customerid = o.customerid
October 15, 2011 at 6:17 pm
SELECT a.CustomerID, COALESCE(SUM(b.Total), 0) Total
FROM Customer a
LEFT JOIN Order b
ON b.CustomerID = a.CustomerID
GROUP BY a.CustomerID
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy