New User: Error 1064

[expired user #9743]'s profile image [expired user #9743] posted 8 years ago in General Permalink

Hello, im new to sql. Been studying for two days. I fired up heidi and run my query as per w3schools teachings and im getting an error on line 2. Something about my syntax being correct amd im unsure why.

SELECT bx-books-rating.isbn, bx-users.location, bx-book-ratings.book-rating

FROM Bx-Book-Ratings

INNER JOIN bx-users

ON bx-book-rating.user-id=bx-users.user-id

Any advice would be greatly appreciated. Thanks.

[expired user #9743]'s profile image [expired user #9743] posted 8 years ago Permalink

Sorry, my syntax being incorrect!! I saw the picture which highlighted tables as purple in heidisql. I dont see that colour in my query. They are highlighted as light yellow ; same as the elements above it (which are just columns).

kalvaro's profile image kalvaro posted 8 years ago Permalink

http://stackoverflow.com/questions/36445627/heidisql-error-1064-syntax-related

As I said there:

  • You should get a fully detailed error message:

SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bx-book-ratings' INNER JOIN 'bx-users' ON 'bx-book-ratings'.user-id='bx-users'.' at line 2

  • Invalid SQL is by no means a HeidiSQL issue, unless you used HeidiSQL to generate it (is that the case?)
[expired user #9743]'s profile image [expired user #9743] posted 8 years ago Permalink

Ah thanks Kalvaro. The back ticks indeed fixed the syntax issue. Im having another problem now tho after joining another table: *SELECT bx-book-ratings.isbn, bx-books.title, bx-users.location, bx-book-ratings.book-rating

FROM bx-book-ratings

INNER JOIN bx-users

ON bx-book-ratings.user-id=bx-users.user-id

INNER JOIN bx-books

ON bx-book-ratings.isbn=bx-boooks.isbn*

kalvaro's profile image kalvaro posted 8 years ago Permalink

Alright... Let's wait then until an upgrade to HeidiSQL fixes the problems...

[expired user #9743]'s profile image [expired user #9743] posted 8 years ago Permalink

FYI i removed all the dashes in my data and the problem went away. it seems having dashes is never a good idea.

Please login to leave a reply, or register at first.