I've the following query:
INSERT INTO
table
(
memberid,
field1,
field2,
field3
)
VALUES
(
:memberid,
(
SELECT
field1,
field2,
field3
FROM
table
WHERE
id = :id
)
)
I'm using PDO prepared statements, but the query doesn't work in this way.
Does anyone know how to combine prepared statements and SELECT variables into one query?
Tnx
Have you considered insert-select?
INSERT INTO mytable (a,b)
SELECT :a, b
FROM myothertable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.