Hi ALL,
I want to display only those TaxRate's columns whose value is not NULL,the TaxRate's columns whose value is NULL should not display and If there is no value for any taxrate's column in the data, then it should Display only 'Excempt' column.
This is my Query.......
SELECT DISTINCT T0.DocNum AS 'Debit Note No.', T0.CardName AS 'Name', T0.CardCode AS 'code', T0.NumAtCard AS 'Supplier Ref.'
,T1.Dscription AS 'Description of Goods', T0.Address, T1.Quantity, T1.Price AS 'Rate', T1.LineTotal AS 'Amount', T0.DocDate,
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0)FROM RPC4 WHERE RPC4.StaType = -90 AND RPC4.DocEntry = T0.DocEntry) AS 'Basic Excise Duty BED@10 %',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = -60 AND RPC4.DocEntry = T0.DocEntry) AS 'Education Cess @2%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = -55 AND RPC4.DocEntry = T0.DocEntry) AS 'Secondary Education Cess @1%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 4 AND RPC4.StaCode = 'CST2' AND RPC4.DocEntry = T0.DocEntry) AS 'Central Sales Tax(CST)',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 1 AND RPC4.StaCode = 'VAT4'AND RPC4.DocEntry = T0.DocEntry) AS 'Input VAT@5%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 1 AND RPC4.StaCode = 'VAT12.5'AND RPC4.DocEntry = T0.DocEntry) AS 'VAT12.5%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 18 AND RPC4.StaCode = 'Add2'AND RPC4.DocEntry = T0.DocEntry) AS 'ADD Tax 1%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 7 AND RPC4.DocEntry = T0.DocEntry) AS 'Excempt'
FROM ORPC T0
INNER JOIN RPC1 T1 ON T0.DocEntry = T1.DocEntry
WHERE (T0.CardCode = 'V00308') AND (T0.DocNum = '9220004)
Thanks
Rahul
|