I have the following SQL code that I am trying to run in Microsoft Query, but I keep running into the error Characters found after end of SQL statement. I understand this might be happening because of code written after semicolons, but to my knowledge > is acceptable. Is there something else wrong with the code?
SELECT `S1`.DATES , `S1`.NAMES , MAX(`LS`.DATES)
FROM `C:LOCATION`.`Sheet1$` `S1`
LEFT OUTER JOIN `C:\LOCATION`.`LargerSheet$` `LS`
ON `S1`.NAMES = `LS`.NAMES
WHERE (`S1`.DATES - `LS`.DATES) > -3 and (`S1`.DATES - `LS`.DATES) < 3
GROUP BY `S1`.DATES, `S1`.NAMES 1 Answer
The code you've posted has been converted to be "HTML safe".
Specifically the < (less than) and > (greater than) symbols have been replaced by their HTML equivalents < and >.
Since the semi-colon (;) denotes the end of an SQL statement, you are in fact doing exactly what it says -- providing characters after the end of the statement (after the semicolon) that are not another statement on their own.
Replace the < and > with the actual < and > characters and try it again.