• 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)

    FROMtbl_shoppingcarts

    INNER JOINtbl_productp ON s.productid =p.productid

    WHERE s.cartid =@cartid

    GROUP BY s.shippingcost;

    Try to format your code. The person who has to read your code will be grateful.

    You can also alias your tables, which makes your query more readable.

    ++++++++++++

    Thanks again Koen, I am new here and still trying to grasp this sql stuff. Your suggestions are noted.

    I added the Group By and it pops up another error:

    Msg 4104, Level 16, State 1, Procedure GetTotalAmount, Line 10

    The multi-part identifier "shippingcart.shippingcost" could not be bound.