我在 SQL 数据库中有类时间表。
INSERT INTO schedule (date)
VALUES
('2016-05-16 13:00:00'),
('2016-05-16 14:00:00'),
('2016-05-16 15:00:00'),
('2016-05-16 16:00:00'),
('2016-05-16 17:00:00'),
('2016-05-17 13:00:00'),
('2016-05-17 14:00:00'),
('2016-05-17 15:00:00'),
('2016-05-17 16:00:00'),
('2016-05-17 17:00:00'),
('2016-05-18 13:00:00'),
('2016-05-18 14:00:00'),
('2016-05-18 15:00:00'),
('2016-05-18 16:00:00'),
('2016-05-18 17:00:00'),
('2016-05-19 13:00:00'),
('2016-05-19 14:00:00'),
('2016-05-19 15:00:00'),
('2016-05-19 16:00:00'),
('2016-05-19 17:00:00');
在变量“date”中创建日期之后。我想将伴随的地点插入到另一个名为“地点”的变量中,在那个特定时间去哪里。像这样
INSERT INTO schedule (place)
VALUES
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A'),
('Room A');
但是我需要确保条目匹配,以便“日期”中的第三个条目与“地点”中的第三个条目匹配。我正在寻找解决方案。如果你有比这个例子更好的整体解决方案,请告诉我:)
最佳答案
INSERT INTO schedule (place, date)
VALUES ('Room A','2016-05-16 13:00:00')
关于mysql - 从特定日期插入 SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36834990/