t sql query

  • 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

  • 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