rhodesjason rhodesjason - 25 days ago 4
SQL Question

Why doesn't this SQL UPDATE query work?

I know SQL well but I must be missing something really dumb here. This update query keeps throwing an error. The query is:

UPDATE pages SET 'order' = 1 WHERE id = 19

The table definitely has a column for order, and it has a record with the ID of 19. The order column is not unique.

The error I get is the generic one:

#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 '"order" = 2 WHERE id = 19' at line 1

I've enclosed order in quotation marks because
is a reserved SQL word. What am I missing?


If using MySQL the query should look like this:

UPDATE `pages` SET `order`=1 WHERE `id`=19