Maneesh A N

Maneesh A N

  • NA
  • 179
  • 108.5k

SUMMING COLUMNS

Sep 3 2013 2:42 AM
ALTER PROCEDURE[dbo].[prctblExpenseMasterDetailsView]   
(   
  @iAccID  int,   
  @FromDate  DateTime,   
  @ToDate  DateTime   
--@dInvoiceDate datetime   
)   
 AS   
 SET NOCOUNT ON   
 BEGIN   
  SELECT   
  TS.iAccID as iAccID,
  TS.vAccName as Name,   
  SUM(SI.vItemName) as Item,
  SUM(SI.iNos) as Qty,
  SI.deRate as Rate,
  SUM(SI.deAmount) as Amount,   
  SUM(TS.dInvoiceDate) as Date   
  FROM tblSales TS INNER JOIN tblSalesItem SI ON TS.iSalesID=SI.iSalesID   
where   
  TS.iAccID=@iAccID AND TS.dInvoiceDate>=@FromDate and dInvoiceDate<=@ToDate   
END   
   

I NEED TO SUM CERTAIN ABOVE MENTIONED COLUMNS .PLEASE GIVE CORRECT CODE WITH INNER JOIN

Answers (7)