我有以下SQL:
INSERT INTO Invite VALUES (NULL,?,(SELECT id FROM User WHERE name = ?),?);
然而,这似乎不起作用。
谁能告诉我我做错了什么?
更新
以下php代码给了我erro代码1136:
$sql = 'INSERT INTO Invite SELECT NULL, ?, id, ? FROM User WHERE username = ?';
$variables = array($team_id,$_SESSION['User']['id'],$username);
$result = $this->db->prepTemplate($sql, 'iis', $variables);
答案 0 :(得分:3)
INSERT INTO Invite
SELECT NULL, ?, id, ?
FROM User
WHERE name = ?