Grand Total

  • Hi

    I have below code and i want to display Grand Total of Quantity , BaseAmt at the end.

    SELECT

    CASE WHEN RR = 1 THEN CAST(DEntry AS varchar(20)) ELSE '' END,

    CASE WHEN RR = 1 THEN CAST(DocNum AS varchar(20)) ELSE '' END 'Inv. No',

    CASE WHEN RR = 1 THEN DocDate ELSE null END 'Doc. Date',

    Quantity,BaseAmt

    FROM

    (SELECT

    (ROW_NUMBER() OVER(PARTITION BY DEntry ORDER BY DEntry)) [RR], *

    FROM #Tmp0) SUBQUERY1

    Thanks

  • what is the final purpose of this SQL - how is it going to be used and where is the final output? e.g. csv file, excel, web page?

     

  • This was removed by the editor as SPAM

  • This sounds like something that should be done in the presentation layer, not the data layer.  This is easy in SSRS, for example.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

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

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