5
Answers

SUM PRICE AND QUNATITY

Maneesh A N

Maneesh A N

11y
932
1
I NEED TO SUM ITEM QUANTITY,ITEM PRICE DATE WISE AND ALSO CUSTOMER NAME WISE IN REPORT,SQL 2005...REPLY SOON PLEASE

ALTER Procedure[dbo].[PrcInvoiceItemPrint]    
(    
--       @iSalesID      int,   
--       @vAccName      varchar,   
         @iAccID        int,      
         @FromDate      DateTime        
--       @ToDate        DateTime  
    
)    
    
 AS          
 SET NOCOUNT ON         
 BEGIN        
    
--select dInvoiceDate from tblSales where dInvoiceDate=@FromDate    
    
    
--select tblSalesItem.iItemID, Max(tblSalesItem.vTea), SUM(tblSalesItem.iNos)    
--FROM   tblSales INNER JOIN    
--tblSalesItem ON tblSales.iSalesID = tblSalesItem.iSalesID    
--where dInvoiceDate=@FromDate    
--group by tblSalesItem.iItemID    
select tblSales.iAccID, tblSales.vAccName,tblSalesItem.iItemID, tblSalesItem.deAmount,tblSalesItem.vTea,tblSalesItem.iNos,tblSales.dInvoiceDate    
FROM   tblSales INNER JOIN    
tblSalesItem ON tblSales.iSalesID = tblSalesItem.iSalesID    
where tblSales.iAccID=@iAccID AND tblSales.dInvoiceDate=Convert(varchar,@FromDate,101)  
--group by tblSalesItem.iItemID    
    
end 
Answers (5)