我有3张桌子

我如何插入类似的东西

Player: player_id, player_name

Date: date_id, date_value

PlayerOnDate: pod_id, player_id, date_id

最佳答案

有一个针对该INSERT INTO ... SELECT的特定SQL语句

INSERT INTO `playerondate`(`player_on_date_id`, `player_id`, `date_date_id`)
SELECT NULL, player_id, date_id
FROM playerondate
WHERE player_name = 'aName' AND date_value LIKE '12122015'

09-19 21:26