• This would do what you are looking for:

    Select p.Month, SUM(p.cramount) As Credit, SUM(q.dramount) As Debit From

    (

    Select b.voucherno, DATENAME(MM, a.dt) As Month, SUM(b.cramount) As cramount From voucher As a

    JOIN voucherCr As b ON a.voucherno = b.voucherno AND a.vouchertype = b.vouchertype

    Group By b.voucherno, DATENAME(MM, a.dt)

    ) As p

    JOIN

    (

    Select b.voucherno, DATENAME(MM, a.dt) As Month, SUM(b.dramount) As dramount From voucher As a

    RIGHT JOIN voucherDr As b ON a.voucherno = b.voucherno AND a.vouchertype = b.vouchertype

    Group By b.voucherno, DATENAME(MM, a.dt)

    ) As q ON p.voucherno = q.voucherno

    Group By p.Month

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉