Skip to Content
0
Former Member
Jun 06, 2011 at 11:25 AM

How to Display the Credit value in new Credit Column

38 Views

Hi,

This is my SQLQuery.

SELECT distinct OINV.DocDueDate AS 'Due date ',OCRD.GroupNum AS 'Payment Terms',(OINV.Doctotal)- (OCRD.balance) as 'Credit 7'

FROM OINV INNER JOIN

OCRD ON OINV.CardCode = OCRD.CardCode

WHERE (OINV.DocDueDate BETWEEN '04/20/2011' and '06/06/2011' and OINV.CardCode='c00032')

union all

SELECT distinct ORCT.DocDueDate AS 'Due date',OCRD.GroupNum AS 'Payment Terms',(ORCT.NoDocSum)- (OCRD.balance) as 'Credit 7'

FROM ORCT INNER JOIN

OCRD ON ORCT.CardCode = OCRD.CardCode

WHERE (ORCT.DocDueDate BETWEEN '04/20/2011' and '06/06/2011' and ORCT.CardCode ='c00032')

-


when i execute this Query ,then it will display :- Date = "2011-05-21" , Payment terms = "7 " and Credit 7 = "-74660.00"

Now i want to add two more Columns Credit 5 and Credit 9 in this Query and

I want if Payment terms =5 , the it should display the Credit in another new column Credit 5

and if Payment terms =9 , the it should display the Credit in another new column Credit 9

and if Credit displays in one Credit column then other Credit Column's value becomes zero.

Kindly give me the solution to solve the above problem

Regards

Rahul