1

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.

1 Answer 1

3

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.

1
  • Great, thanks for letting me know Mateusz :) Mar 26, 2021 at 13:49

Not the answer you're looking for? Browse other questions tagged .