New to SQL so be nice! :)

I'm trying to run a simple SQL query in Automation studio, unfortunately I am getting this error - "An error occurred while checking the query syntax. Errors: Incorrect syntax near the keyword 'Key'."

select Account_ID, First_Name, Gender, Communication Key, Email_Address,
SubscriberKey from [TEST_De]
where Subscriberkey not in (select Subscriberkey from _sent where JobID = XXXXXX)

Now, straight away the empty character in Communication Key stands out as the culprit. However please note that this is exactly how the field is presented in the DE.


Columns that contain space or use reserved SQL keyword needs to be wrapped in the square brackets so that the query knows it is a single Column.

Use [Communication Key], and all should work.

  • Great, thanks for letting me know Mateusz :) – Jordan Miguel Mar 26 at 13:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.