3 Replies - 806 Views - Last Post: 08 August 2019 - 09:52 AM

#1 Splashsky   User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 354
  • Joined: 25-August 13

Syntax Error 1064

Posted 08 August 2019 - 09:48 AM

Hey there! And friend and I are stumped on a very simple query that throws a 1064 for us.

SELECT * FROM messages WHERE from = 1

Why is this line problematic, and why does the syntax checker put the error at from = 1?

Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: Syntax Error 1064

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15433
  • View blog
  • Posts: 61,842
  • Joined: 12-June 08

Re: Syntax Error 1064

Posted 08 August 2019 - 09:51 AM

Do you have a column called 'from'? It's a reserved word used in SQL queries. I would suggest a better name for the column... at the least put brackets around it to signify it is different from the 'FROM <table name>'.
Was This Post Helpful? 1
  • +
  • -

#3 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3040
  • View blog
  • Posts: 11,683
  • Joined: 03-December 12

Re: Syntax Error 1064

Posted 08 August 2019 - 09:51 AM

“from” is a reserved word.
Was This Post Helpful? 0
  • +
  • -

#4 Splashsky   User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 354
  • Joined: 25-August 13

Re: Syntax Error 1064

Posted 08 August 2019 - 09:52 AM

Oof. My bad! Wasnt aware. Thanks for the quick response guys
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1