1 INSERT INTO `game_2015newterm_user` (`uid`, `lq`, `xm`, `ct`, `by`, `lj`, `xmlbq`, `ctlbq`, `bylbq`, `ljlbq`, `tdate`) select uid, '0', '3', '0', '0', '0', '0', '0', '0', '0', '2015-03-16' from game_2015school_user
從表game_2015school_userzhong獲取用戶id,使用常量select查詢構造字段數據。
INSERT INTO `event_2125`.`game_2015newterm_user` (`uid`, `lq`, `xm`, `ct`, `by`, `lj`, `xmlbq`, `ctlbq`, `bylbq`, `ljlbq`, `tdate`, `uptime`) VALUES ((select uid from game_2015school_user where uid=608035003 ), '0', '0', '0', '0', '0', '0', '0', '0', '0', '2015-03-16', CURRENT_TIMESTAMP);
錯誤。 insert select 不能使用values, 並且 select uid from ... 獲取的數據不是唯一值。