Quantcast
Viewing all articles
Browse latest Browse all 2794

Re: Need to sum 2 fields

Hi Vinod,

 

To get the sum of the two fields per line, you have to remove the DocDate from the GroupBy, if you filter by it you put it just into the where Clause.

 

There is also no need to the Distinct function.

 

your query will look like that :

 

 

Select  T0.CARDCODE,T0.CARDNAME,Sum(T0.DOCTOTAL) AS 'DocTotal'

FROM OINV T0

INNER JOIN INV1 T1 ON T0.DOCENTRY = T1.DOCENTRY

INNER JOIN OCRD ON T0.CARDCODE = OCRD.CARDCODE

WHERE T1.TARGETTYPE <> 14

AND OCRD.QryGroup1 = 'Y'

AND T0.[DocDate]  > [%0] AND T0.[DocDate]  < [%1]

Group by T0.CARDCODE,T0.CARDNAME

 

Please add the other fields to the query, I don't have them in my Database.

 

Regards,

Mohamed.


Viewing all articles
Browse latest Browse all 2794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>