Hi,
Try this query:
SELECT [A] as CustCode, [Acctname] as AcctName, ISNULL([1],0) as Jan, ISNULL([2],0) as Feb, ISNULL([3],0) as Mar, ISNULL([4],0) as Apr, ISNULL( [5],0) as May, ISNULL([6],0) as june, ISNULL([7],0) as July, ISNULL([8],0) as Aug, ISNULL([9],0) as Sept, ISNULL([10],0) as Oct, ISNULL([11],0) as Nov, ISNULL([12],0) as Dec
from
(SELECT T3.cardcode as A, T0.[AcctName] as AcctName,(T1.[Debit]-T1.[Credit]) as Bal,month(T2.[RefDate]) as month FROM [dbo].[OACT] T0 INNER JOIN JDT1 T1 ON T0.AcctCode = T1.Account INNER JOIN OJDT T2 ON T1.TransId = T2.TransId left join OCRD T3 on t3.cardcode = t1.shortname WHERE T2.[RefDate] between [%1] and [%2] and year(T2.[RefDate]) = 2014 and t3.cardtype IN( 'c','s') group by T3.cardcode , T0.[AcctName],T2.[RefDate],T1.[Debit],T1.[Credit]) s
Pivot
(sum(Bal) FOR Month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
OR
Please post your query to check and modify to avoid hanging issue.
Thanks & Regards,
Nagarajan