我正在尝试将数据插入到使用没有子查询的数据查询创建的预留表中。但它显示ERROR 1093(HY000):您无法指定目标表'预留'用于FROM子句中的更新
CREATE TABLE reservation (
reservationID INT AUTO_INCREMENT,
roomID INT(10) NOT NULL,
customerName VARCHAR(20) NOT NULL,
startDate DATE NOT NULL,
endDate DATE NOT NULL,
totalNumOfDays INT(10),
totalCost DOUBLE(10,2),
cancelled BOOLEAN NOT NULL DEFAULT FALSE,
updateOn TIMESTAMP not null ON UPDATE current_timestamp,
PRIMARY KEY(reservationID),
FOREIGN KEY(roomID) references room(roomID),
FOREIGN KEY(customerName) references user(username));
ALTER table reservation auto_increment = 1000;
INSERT INTO reservation(roomID,
customerName,
startDate,
endDate,
totalNumOfDays,
totalCost,
cancelled )
values ( 37, 'customer1',( SELECT STR_TO_DATE('01,12,2017','%d,%m,%Y')),
( SELECT STR_TO_DATE('02,12,2017','%d,%m,%Y')),1,200,FALSE);
roomID = 37,customerName =' customer1'已经在表格中