views:

31

answers:

2

I used this query to copy one full column from the same table:

UPDATE 'content_type_chapter' 
   SET 'field_chapternumbersort2_value' = 'field_chapternumbersort_value'

But I have received this error.

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 ''content_type_chapter' SET 'field_chapternumbersort2_value'='field_chapternumber' at line 1

What could be wrong, I'm unable to get it right.

+2  A: 

Single-quotes are for strings.

Try backticks instead, e.g.:

UPDATE 
    `content_type_chapter` 
SET 
    `field_chapternumbersort2_value` = `field_chapternumbersort_value`

The backticks aren't strictly necessary, though.

Adam Bernier
This too worked, so basically.. quotes were the culprit.
Nikhil
+1  A: 

Just leave the quotes off your field names, otherwise it thinks you are giving it strings

Zak