Reputation: 3764
Trying to do an insert in MySQL and getting an error that I cannot figure out. The syntax (at least from my perspective) is right. I've tried tinkering around with a lot of little things and cannot figure it out. Also tried dropping and recreating the table and it still happens.
Insert Code:
insert into `apType` (`type`) values (`private`),(`public`),(`military`);
table creation code:
CREATE TABLE `apType`(
`id` int primary key AUTO_INCREMENT,
`type` varchar(255) NOT NULL
)ENGINE=MyISAM DEFAULT CHARSET=latin1;
error code generated:
Upvotes: 0
Views: 43
Reputation: 359
This is a correct SQL - notice single quotes on values being inserted:
INSERT INTO `apType` (`type`) VALUES ('private'),('public'),('military');
What your SQL is actually doing is trying to insert values from fields private, public and military - which in fact do not exist.
Upvotes: 1