Subtracting From SUm

  • I need a Quarry that will total a sum then subtract certain columns from that total sum.

    Select Salesrep_Customerid,SUM(PaymentAmount MINUS(Totalshippingcost AND Salestax1))As "Weekly Total"

    From Orders

    Where OrderStatus='Shipped'

    Between Orderdate('2011/01/10') AND Orderdate('2011/01/19')

    I have this so far..

  • You're close. It's all in the placement of the parenthesis.

    SELECT

    Salesrep_Customerid

    ,SUM(PaymentAmount) - (SUM(Totalshippingcost) + SUM(Salestax1)) AS [Weekly Total]

    FROM

    ...........

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

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

You must be logged in to reply to this topic. Login to reply