错误#1064 MySQL语法错误

时间:2015-11-18 23:52:05

标签: mysql phpmyadmin

我正在尝试将几个品牌导入表格中。

  

INSERT INTO fme_brandsbrand_idbrand_namebrand_websitebrand_addressbrand_logobrand_featured,{{1 }},brand_contact_namebrand_contact_phonebrand_detailsidentifierbrand_page_titlebrand_meta_keywordsbrand_meta_descriptionstatuscreated_time)价值观   (141,'Accu-Cable','www.americandj.com/ProductsList.aspx?Category = ACCU%20Cable',NULL,'manufacturer / files / a / c / accu-cable.jpg',0,NULL,NULL ,NULL,'accu-cable','Accu-Cable',NULL,NULL,1,'2015-11-17 00:01:49','2015-11-17 00:01:49');(142 ,'Actasign',NULL,NULL,'manufacturer / files / no_image_available.jpg',0,NULL,NULL,NULL,'actasign','Actasign',NULL,NULL,1,'2015-11-17 00:01 :49','2015-11-17 00:01:49');(143,'Adam',NULL,NULL,'manufacturer / files / no_image_available.jpg',0,NULL,NULL,NULL,'adam' ,'Adam',NULL,NULL,1,'2015-11-17 00:01:49','2015-11-17 00:01:49');   (144,'ADI',NULL,NULL,'manufacturer / files / no_image_available.jpg',0,NULL,NULL,NULL,'adi','ADI',NULL,NULL,1,'2015-11-17 00 :01:49','2015-11-17 00:01:49');   (145,'ADJ','www.adj.com',NULL,'manufacturer / files / a / m / american-dj_1.jpg',0,NULL,NULL,NULL,'american-dj','ADJ' ,NULL,NULL,1,'2015-11-17 00:01:49','2015-11-17 00:01:49');   (146,'Adobe',NULL,NULL,'manufacturer / files / no_image_available.jpg',0,NULL,NULL,NULL,'adobe','Adobe',NULL,NULL,1,'2015-11-17 00 :01:49','2015-11-17 00:01:49');   (147,'Aerial7','www.aerial7.com',NULL,'manufacturer / files / a / e / aerial7.jpg',0,NULL,NULL,NULL,'aerial7','Aerial7',NULL,NULL ,1,'2015-11-17 00:01:49','2015-11-17 00:01:49');   (148,'Akai Professional','www.akaipro.com',NULL,'manufacturer / files / a / k / akai.gif',0,NULL,NULL,NULL,'akai-professional','Akai Professional' ,NULL,NULL,1,'2015-11-17 00:01:49','2015-11-17 00:01:49');

虽然第一行总是正确导入,但我收到语法错误“#1064 - 您的SQL语法中有错误;请查看与您的MySQL服务器版本对应的手册,以便在'142'附近使用正确的语法Actasign',NULL,NULL,'manufacturer / files / no_image_available.jpg',0,N“

这让我相信每行开头的括号都有问题?谁知道我哪里出错?

1 个答案:

答案 0 :(得分:2)

每个值设置后,您需要逗号而不是分号: e.g。

来自manual

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

您的查询:

INSERT INTO fme_brands (brand_id, brand_name, brand_website, brand_address, brand_logo, brand_featured, brand_contact_name, brand_contact_phone, brand_details, identifier, brand_page_title, brand_meta_keywords, brand_meta_description, status, created_time, update_time) 
VALUES 
(141, 'Accu-Cable', 'www.americandj.com/ProductsList.aspx?Category=ACCU%20Cable', NULL, 'manufacturers/files/a/c/accu-cable.jpg', 0, NULL, NULL, NULL, 'accu-cable', 'Accu-Cable', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(142, 'Actasign', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'actasign', 'Actasign', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(143, 'Adam', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adam', 'Adam', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(144, 'ADI', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adi', 'ADI', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(145, 'ADJ', 'www.adj.com', NULL, 'manufacturers/files/a/m/american-dj_1.jpg', 0, NULL, NULL, NULL, 'american-dj', 'ADJ', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(146, 'Adobe', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adobe', 'Adobe', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(147, 'Aerial7', 'www.aerial7.com', NULL, 'manufacturers/files/a/e/aerial7.jpg', 0, NULL, NULL, NULL, 'aerial7', 'Aerial7', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(148, 'Akai Professional', 'www.akaipro.com', NULL, 'manufacturers/files/a/k/akai.gif', 0, NULL, NULL, NULL, 'akai-professional', 'Akai Professional', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49');

这就是您在查询中导入的第一个值集的原因,因为它类似于以下内容:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3); #ok
(4,5,6),(7,8,9); #error, no INSERT INTO