在mysql中,创建表时,注意不要使用关键字做为列名,比如字段:left 、 right。 如果使用关键字,在进行条件查询时会出现如下问题 1 queries executed, 0 success, 1 errors, 0 warnings Query: select * from article WHERE (status=0 OR status =1) and column = 1 LIMIT 0, 1000 Error Code: 1064 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 'column = 1 LIMIT 0, 1000' at line 1 Execution Time : 0 sec Transfer Time : 0 sec Total Time : 0 sec 解决方案:给关键字加上“反引号”,看清了,是反引号,而不是单引号。 SELECT id, x_row, y_column, up, down, `LEFT`, `RIGHT`, check_code, back_pic FROM t_position_import_err WHERE status = 1 |
Archiver|知识站 ( 鲁ICP备20004068号-1 )
GMT+8, 2020-6-26 13:45 , Processed in 0.016177 second(s), 17 queries .