3
Answers

How we can use RowNumber()

Ramco Ramco

Ramco Ramco

Mar 13
116
1

Hi

  I have below query .

SELECT

A."DocNum",A."DocDate",A."CardCode",A."CardName",

A."StcCode", A."CGST",A."SGST",A."IGST",A."LocGSTN",A."BpGSTN",A."Total Amount"

from (

select

t0."DocNum",t0."DocDate",Max(t0."CardCode") As "CardCode",Max(t0."CardName") As "CardName",t2."StcCode",


(Select SUM(A0."TaxSum") from Inv4 A0 where A0."DocEntry" = T0."DocEntry" and A0."staType" = -100 and A0."StcCode" = t2."StcCode") as "CGST",

Max(T0."DocTotal"+T0."DpmAmnt") As "Total Amount"

from oinv t0

left join inv4 t2 on t2."DocEntry" = t0."DocEntry"

where t0."DocDate" >= '2014/12/01' AND  t0."DocDate" <= '2025/03/01'

group by t0."DocEntry",t0."DocNum",t0."DocDate",t2."StcCode",t0."CardCode",t0."ShipToCode"

I want data like below . If 1 Doc No has multiple rows then Grand Total should appear only once. How we can use RowNumber() in above query

19137 CSGST-18 13525.2 28150
19137 CSGST-18 13525.2 28150
19137 CSGST-18 384.95 28150
19137 CSGST-18 384.95 28150
19137 CSGST-18 164.52 28150
19137 CSGST-18 164.52 28150
       
19137 CSGST-18 13525.2 28150
19137 CSGST-18 13525.2  
19137 CSGST-18 384.95  
19137 CSGST-18 384.95  
19137 CSGST-18 164.52  
19137 CSGST-18 164.52  

Thanks

Answers (3)