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);引用

相關文章
相關標籤/搜索