I was trying to update approx 20,000 records in a table by using statements like this one,
however, I got the message say 0 row(s) affected so it didn\'t work.<
By default MySQL allows double quoted names to be understood as either identifiers (like column names) or as string literals.
This is meant as a convenience, but I find the semantic ambiguity frustrating. MySQL must resolve the ambiguity, and cannot magically always guess the coder's intention, as you discovered.
-- In default sql_mode under 5.5
--
SELECT "foo" -- "foo" is a *column* if tbl.foo exists, otherwise a string
FROM "tbl" -- Oops! ER_PARSE_ERROR (1064) Can't do this in default mode.
WHERE "foo" = "foo"; -- Both of these are strings
So, the way around it is to force unambiguous interpretation of identifiers:
sql_mode to include ANSI_QUOTES (or a superset of it)#3 is my personal favorite, for readability and portability. The problem is it tends to surprise people who only know MySQL, and you have to remember to override the default.