0

It makes no sense. I have a TINYINT field that is either 0 or 1 and I'm trying to set it like this:

UPDATE db_products SET return='1' WHERE product_id=342343434

But it tells me there's a mySQL syntax error. What am I doing wrong here? Is the problem that the field is called return? If so, how do I get around it without changing it?

user1227914
  • 3,446
  • 10
  • 42
  • 76

1 Answers1

1

In most cases, you can get around reserved word problems by enclosing with "ticks"; the quote-like thing that usually shares the ~ key.

UPDATE db_products SET `return`='1' WHERE product_id=342343434
Uueerdo
  • 15,723
  • 1
  • 16
  • 21
  • Just tried that but neither `"return=1"` nor `"return"=1` seems to work :( Same mySQL error. – user1227914 Aug 03 '15 at 22:23
  • Not double quote, the "backtick" on the upper leftmost corner of US keyboards. (see update for example). – Uueerdo Aug 03 '15 at 22:24
  • Stretch that left pinky – Drew Aug 03 '15 at 22:25
  • @njzk2 Yes, MySQL specific, but do not behave exactly like " (depends on server config). – Uueerdo Aug 03 '15 at 22:26
  • @Uueerdo sorry, I though that was an SQLite question (I saw a lot of those, and I usually don't read MySQL question) – njzk2 Aug 03 '15 at 22:27
  • @njzk2 No prob, after working with MySQL for over a decade now, it is embarassing to admit I didn't know you could even use " for field delimiting until about year ago. ;) – Uueerdo Aug 03 '15 at 22:32