I’m trying to write a query where I’m pulling some numbers (theowin/trips) comparing two dates. I Want to see see the data from one table for a month added to a date in another. I’m getting a syntax error.
In general, I want to know how to fix my sentax:
SELECT t1.PtnId, t2.compDate, (SELECT sum(t2.TheoWin)/sum(t2.Trips) WHERE (t2.DateBuyIn BETWEEN t1.compDate AND DATEADD (month, 1, t1.compdate) AS '+1 Months' FROM t1.vVW_DWH_PTNSLots
JOIN t2.vCXComps
ON t1.PtnID=t2.ptnI
My error is:
SyntaxError: Expected "#", "%", "&", ")", "*", "+", ",", "-", "--", "/", "/*", "<<", ">>", "AND", "ON", "OR", "OVER", "^", "div", "|", "~", or [ tnr] but "A" found.
I see no issues with the code