如何使用insert和select query插入多行。
Exception calling "SendWait" with "1" argument(s): "Access is denied"
+ CategoryInfo : NotSpecified: (Exception calli...cess is denied":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
答案 0 :(得分:2)
您可以使用union all
:
INSERT INTO contacts(`studentId`, `contactId`, `firstName`, `lastName`)
SELECT studentId, '1234', 'kavin', 'kumar'
FROM student
WHERE sampId = '8580'
UNION ALL
SELECT studentId, '108', 'karthi', 'kumar'
FROM student
WHERE sampId = '5650';
如果id列是数字,则不要在值周围使用单引号。