The error is in the sum function
SELECT dbo.ForecortTBL.ForecourtD AS ForcourtD, dbo.ForecortTBL.ForecourtName, sum(Stockvalue = TankReading(TankTBL) * FuelWholeSaleRetailPrice(FuelTBL))
FROM dbo.TankTBL INNER JOIN
dbo.FuelTBL ON dbo.TankTBL.FuelID = dbo.FuelTBL.FuelID CROSS JOIN
dbo.ForecortTBL
GROUP BY dbo.ForecortTBL.ForecourtD, dbo.ForecortTBL.ForecourtName
Assuming TankReading and FuelWholeSaleRetailPrice are valid stored procs or functions that are accessiblr to the query, it should probably read
SUM(TankReading(TankTBL) * FuelWholeSaleRetailPrice(FuelTBL)) AS Stockvalue
1 Like
While we’re at it…
10$ says you trip yourself up there… missing an e
perhaps?
2 Likes
r937
4
you’re so kind
hey, anyone else relieved to see a new thread on here after two weeks of absolutely nothing?
Thanks for your help guys, had to change it up a bit but finally got it working as i wanted it too.
sum(ISNULL(dbo.TankTBL.TankReading * dbo.FuelTBL.FuelWholeSaleRetailPrice,0))
as StockValue,Count_BIG(*) as NoOfPumps
system
Closed
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.