如何在sql中添加其他列

时间:2014-03-27 06:50:17

标签: sql sql-server

我有这个查询

SELECT Count(IN_Invoices.in_id) NoOfInv,
       sum(in_total) AMTsum,
       CLOI_ClientOrderItems.cl_Id     
  from (select distinct 
               MasterOrderId, 
               cl_Id 
          from CLOI_ClientOrderItems) as CLOI_ClientOrderItems 
       inner Join IN_Invoices 
            on IN_Invoices.MasterOrderId = CLOI_ClientOrderItems.MasterOrderId
group by 
       CLOI_ClientOrderItems.cl_id

查询结果为

NoOfInv   AMTsum      cl_id
7         245        100000pri
247       181110.29  100001pro

Grandtotal,presentmonthtotal,firstpreviousmont,secondpr,remainingamount

我的表格中包含日期的发布日期列  presentmonthtotal - >需要在发布日期列中搜索并显示该月份详细信息

0 个答案:

没有答案