MySql error analysis Unknown column 'xxx' in 'where clause'

I have encountered problems similar to Unknown column 'xxx' in 'where clause' when updating the database. From a literal understanding, it is easy to conclude that the column name does not exist, but in many cases the start is not caused by the wrong column name. It is caused by the lack of quotation marks for character type data when piecing together the sql statement.


For example: a sql statement:

    UPDATE tbl_Mdr SET nRecvTime=%s WHERE strMsgId=%s , then the error is as follows:

Unknown column
‘ysy′ in ‘where clause’

If the string type in sql must be enclosed in quotation marks.

So modify sql to UPDATE tbl_Mdr SET nRecvTime='%s' WHERE strMsgId='%s'

then the error disappears. .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324134655&siteId=291194637