I am new to SQL. I am trying to convert a query to use parameters picked up from the Excel sheet. I have made parameter input to work with other queries but this one is fighting hard I have tried all sorts of options, some still in the code and get various error messages including Invalid Columns, "No column name was specified for column of R"
Where have I gone wrong ?![]()
DECLARE @StartDate DATETime, @EndDate datetime SELECT DISTINCT A.AccountNumber, AccountName AS 'Name', COALESCE(R.SumAc,0) AS 'Total' FROM qryNLSLPLPostedTrans as A LEFT JOIN ( SELECT AccountNumber, SUM(GoodsValueInBaseCurrency) AS 'SumAc' FROM qryNLSLPLPostedTrans WHERE TransactionDate BETWEEN [@StartDate] AND [@EndDate] /* WHERE TransactionDate BETWEEN [] AND [] */ GROUP BY AccountNumber ) as R ON A.AccountNumber=R.AccountNumber ORDER BY AccountNumber, AccountName
I am using variables to make the queries as generic as possible.
Thanks for any help











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks