mysql 数据库名称,中间带有中划线问题

插入数据时候,引用了数据库名,数据库名中有横线,会提示错误:数据库

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right sy                                                                  ntax to use near '-all.db1(operationuser,operationtime,notes,ebay_id,types)spa

解决办法:server

把数据库名、表名都用反引号引发来就能够了。io

好比:select

 insert into `db1`.`tbl1`(operationuser,operationtime,notes,ebay_id,types)(select operationuser,operationtime,notes,ebay_id,types from `db2`.`tbl2` where  `operationtime` >1367337600 order by id asc);引用

相关文章
相关标签/搜索