#1054 - “字段列表”中的未知列'id'

时间:2014-02-21 13:07:34

标签: mysql

INSERT INTO `brands` (`id`, `brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
(1, 'Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(2, 'Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(3, 'Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(4, 'Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(5, 'Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(6, 'Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(7, 'Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(8, 'Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(9, 'Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(10, 'Fiat', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(11, 'Toyota', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(12, 'Nissan', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(13, 'Chevrolet', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(14, 'Mitsubishi ', 0, '2013-12-05 13:30:00', '201[...]

2 个答案:

答案 0 :(得分:0)

如果您的id列是自动增量,那么您不需要在插入查询中添加id

试试这个

INSERT INTO `brands` ( `brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
('Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Fiat', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Toyota', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Nissan', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Chevrolet', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Mitsubishi ', 0, '2013-12-05 13:30:00', '201[...]

答案 1 :(得分:-1)

您应该使用ID作为主键,并且您的表是否具有'id'作为字段?

 INSERT INTO `brands` (`brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
('Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
[...]