SQL Code Error `Characters found after end of SQL statement`

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 &lt; and &gt;.

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 &lt; and &gt; with the actual < and > characters and try it again.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like