如何获取特定的cl_id订单详细信息和金额

时间:2014-03-26 11:32:38

标签: sql sql-server

在thisquery中我想显示特定的cl_id订单明细和ammount

select  
    distinct dbo.CLOI_ClientOrderItems.cl_id,
    count(dbo.IN_Invoices.MasterOrderId) as Orders,
    OverallTotal = (select 
                        sum(in_total) 
                    from IN_Invoices 
                    where datepart(mm,in_date_issued)=1 and                          
                          datepart(yyyy,in_date_issued)=2014)  
from IN_Invoices
inner join CLOI_ClientOrderItems on 
    IN_Invoices.MasterOrderId=CLOI_ClientOrderItems.MasterOrderId
where CLOI_ClientOrderItems.cl_id='100000_Pri' 
group by cl_id

0 个答案:

没有答案