pavithrareddyc
SSC Enthusiast
Points: 109
More actions
October 15, 2011 at 9:46 am
#390631
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
NotoriousDBA
SSChasing Mays
Points: 658
October 15, 2011 at 6:17 pm
#1395015
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