MYSQL插入语句不起作用。错误1064语法

时间:2016-02-09 15:33:53

标签: mysql sql mysql-error-1064

这是我的代码:

INSERT INTO aggregate_summary (sampler_label,aggregate_report_count,average,aggr
egate_report_median,aggregate_report_90%_line,aggregate_report_min,aggregate_rep
ort_max,aggregate_report_error%,aggregate_report_rate,aggregate_report_bandwidth
,aggregate_report_stddev) VALUES ("2010 sf1","238","276","16","224","2","3121","
0.0","55.04162812210916","249.6223837881591","766.5325177049589"), ("TOTAL","238
","276","16","224","2","3121","0.0","55.04162812210916","249.6223837881591","766
.5325177049589")

我收到此错误:

  

错误1064(42000):您的SQL语法有错误;检查   手册,对应右边的MySQL服务器版本   在'egate附近使用的语法   _report_median, “aggregate_report_90%_line”,aggregate_report_min,aggregate_r”   在第1行

有人可以帮助确定我的问题,谢谢!

2 个答案:

答案 0 :(得分:3)

您必须在反引号中添加任何带有空格或标点符号(如百分号)的列名。

INSERT INTO foo ( `some column`, `other column %`, ...

答案 1 :(得分:0)

你需要通过将列放在`字符之间来定义列,因为有些列使用enter image description here作为mysql,就像名为average的列

INSERT INTO aggregate_summary (sampler_label,aggregate_report_count,`average`,`aggr
egate_report_median`,`aggregate_report_90%_line`,aggregate_report_min,aggregate_rep
ort_max,aggregate_report_error%,aggregate_report_rate,aggregate_report_bandwidth
,aggregate_report_stddev) VALUES ("2010 sf1","238","276","16","224","2","3121","
0.0","55.04162812210916","249.6223837881591","766.5325177049589"), ("TOTAL","238
","276","16","224","2","3121","0.0","55.04162812210916","249.6223837881591","766
.5325177049589")