Koen Verbeeck (6/5/2014)
The error is pretty straight forward:
you need to add a group by clause.
DECLARE @Amount MONEY;
DECLARE @totAmn MONEY;
SELECT ISNULL(SUM(p.price*s.quantity)+ s.shippingcost,0)
FROM tbl_shoppingcart s
INNER JOIN tbl_product p ON s.productid =p.productid
WHERE s.cartid =@cartid
GROUP BY s.shippingcost;
Try...