Skip to Content
0
Former Member
Jun 09, 2011 at 07:41 AM

How to Show only One Credit Column at a time

24 Views

Hi,

This is the Query :- it displays all the credit columns simultaneously

SELECT OINV.DocDate AS 'Posting date',

OCRD.GroupNum AS 'Payment Terms', OCRD.Balance AS 'Amount', OINV.DocTotal AS ' Debit Amount',

CASE WHEN OCRD.GroupNum = 7 THEN (OINV.DocTotal - OCRD.BALANCE) ELSE 0 END AS 'Credit 7',

CASE WHEN OCRD.GroupNum = 9 THEN (OINV.DocTotal - OCRD.BALANCE) ELSE 0 END AS 'Credi 9',

CASE WHEN OCRD.GroupNum = 5 THEN (OINV.DocTotal - OCRD.BALANCE) ELSE 0 END AS 'Credi 5',

OINV.DocDueDate AS 'Due date ',OINV.Address

FROM OCRD INNER JOIN

OINV ON OINV.CardCode = OCRD.CardCode

WHERE (OINV.DocDate BETWEEN '04/08/11' AND '06/09/11' AND OINV.CardCode = 'C00356')

-


- it displays all the credit columns simultaneously

i want if GroupNum =7 then ,it should display the data in Credit 7 Column and rest Credit 5 and Credit 9 should be hide (Credit 5 and Credit 9 columns should not be shown in the data)

Similarly, if GroupNum =5 then, it should display the data is Credit 5 Column and rest Credit 7 and Credit 9 should be hide

similarly for GroupNum =9.

Kindly give me the solution for this problem.

Regards

Rahul