# 应显示按月计算的数值[英] monthwise values should displayed

### 问题描述

`select isnull(sum (case 当 InvoiceMaster.InvoiceDate在@jan_from 和 @jan_to 然后之间转换(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)作为一月，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @feb_from 和 @feb_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as 二月，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @mar_from 和 @mar_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as mar,isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @apr_from 和 @apr_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as apr,isnull (sum (case when InvoiceMaster.InvoiceDate between @may_from 和 @may_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as 可能，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @jun_from 和 @jun_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as 君，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @jul_from 和 @jul_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as 七月，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @aug_from 和 @aug_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as 八月，isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @sep_from 和 @sep_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as sep,isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @oct_from 和 @oct_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as oct,isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @nov_from 和 @nov_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as nov,isnull (sum (case when InvoiceMaster.InvoiceDate 之间 @dec_from 和 @dec_to 然后 convert(十进制(16,4),(InvoiceMaster.value-CollectionMaster.Amount)) end),0)as dec从 InvoiceMaster,CollectionMaster where CollectionMaster.Invoiceid=InvoiceMaster.id`

`SELECT ISNULL(CONVERT(DECIMAL(16,4),(InvoiceMaster.value-CollectionMaster.Amount)),0), GETDATE(month,InvoiceMaster.InvoiceDate) AS InvoiceMonth FROM InvoiceMaster,CollectionMaster WHERE CollectionMaster.InvoiceId=InvoiceMaster.id GROUP BY InvoiceMonth`