Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)

  • RE: Sum Three Columns From Two Tables

    Koen Verbeeck (6/5/2014)


    If you add something to NULL, the result is NULL. Then the ISNULL fuction will replace this with 0. So the output is what one would expect considering...

  • RE: Sum Three Columns From Two Tables

    Koen Verbeeck (6/5/2014)


    nkweke (6/5/2014)


    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...

  • RE: Sum Three Columns From Two Tables

    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...

  • RE: Sum Three Columns From Two Tables

    Many thanks for your concern. Here is what I have done; but is flagging up error:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE [dbo].[GetTotalAmount]

    (@cartid char(36))

    AS

    BEGIN

    declare @Amount money

    declare @totAmn money

    select isnull(sum(tbl_product.price*tbl_shoppingcart.quantity)+ tbl_shoppingcart.shippingcost,0)...

Viewing 4 posts - 1 through 4 (of 4 total)