📜  mysql foreach 插入 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:34.109000             🧑  作者: Mango

代码示例1
-- You don't use the VALUES keyword when inserting from a SELECT
INSERT INTO gesdoc_docs_authorizations
    (`gesdoc_docs_id`, `id_profil_do`, `autorisation`, `personal_doc`)
SELECT g.id, d.id, 1, 0
FROM gesdoc_docs g
JOIN users_profil_do d
-- If you don't use an ON clause to specify a join condition, it treats all rows as matching, which results in a full cartesian product of the two tables