The incorrect syntax (first query) does not appear to throw an error in MySQL even though it's clearly wrong. Why is this?
This is the incorrect syntax
UPDATE
ATable
SET
AColumn = '' AND
BColumn = '' AND
CColumn = ''
WHERE
IDColumn = '';
This is the correct syntax
UPDATE
ATable
SET
AColumn = '',
BColumn = '',
CColumn = ''
WHERE
IDColumn = '';
答案 0 :(得分:3)
UPDATE Statement not generating syntax error when using AND instead of COMMA
this exact question was answered there.
SET NAME = '123' AND Address = '456'
is parsed to something like:
SET NAME = ('123' AND (Address = '456'))
which is one comparison and boolean AND of a string and boolean operands.