This is my query but there is an error - 'INCORRECT SYNTAX NEAR WHERE'
how should i proceed
UPDATE UpdateChecker
Set UPDATED = Case
WHEN Datediff(DAY, CURRENT_TIMESTAMP, (SELECT TOP(1) ['Debt Market Data$'].Date From ['Debt Market Data$'] ORDER BY Date Desc)) = 0
THEN 'YES'
ELSE 'NO'
WHERE [TABLE NAME]='Debt Market Data$'
END
CodePudding user response:
You just have to put your where after the case when ... end clause.
update UpdateChecker
set updated = case when ... then 'YES' else 'NO' end
where ....