query
SELECT distinct CONVERT(varchar,EntryDate,103)EntryDate,
mt.VoucherNo,sum(mt.DAmount)Amt,mt.AccStatement,
STUFF((SELECT ', ' +(select AccChart.ActName from AccChart where CONVERT(nvarchar(50),AccChart.ActCode)= t2.ActCode) FROM AccGl2014 t2
WHERE t2.VoucherNo = mt.VoucherNo FOR XML PATH ('')) ,1,2,'') as AccountName ,STUFF((SELECT ', ' + t3.Descrp FROM AccGl2014 t3
WHERE t3.VoucherNo = mt.VoucherNo FOR XML PATH ('')) ,1,2,'') as Descrp
FROM dbo.AccGl2014 mt where (mt.AccStatement='JV' or mt.AccStatement='Cash' or mt.AccStatement='Bank' ) and mt.EntryDate
between '04/01/2014' and '04/05/2014' group by mt.VoucherNo,mt.EntryDate,mt.AccStatement order by mt.VoucherNo desc
normal code
SELECT distinct CONVERT(varchar,EntryDate,103)EntryDate,
mt.VoucherNo,sum(mt.DAmount)Amt,mt.AccStatement,
STUFF((SELECT ', ' +(select AccChart.ActName from AccChart where CONVERT(nvarchar(50),AccChart.ActCode)= t2.ActCode) FROM AccGl2014 t2
WHERE t2.VoucherNo = mt.VoucherNo FOR XML PATH ('')) ,1,2,'') as AccountName ,STUFF((SELECT ', ' + t3.Descrp FROM AccGl2014 t3
WHERE t3.VoucherNo = mt.VoucherNo FOR XML PATH ('')) ,1,2,'') as Descrp
FROM dbo.AccGl2014 mt where (mt.AccStatement='JV' or mt.AccStatement='Cash' or mt.AccStatement='Bank' ) and mt.EntryDate
between '04/01/2014' and '04/05/2014' group by mt.VoucherNo,mt.EntryDate,mt.AccStatement order by mt.VoucherNo desc
normal code