当前位置:Gxlcms > 数据库问题 > mysql insert插入新形式,再也不需要拼接多重insert啦

mysql insert插入新形式,再也不需要拼接多重insert啦

时间:2021-07-01 10:21:17 帮助过:2人阅读

原理是“表插表”

INSERT INTO prod_attr 
select A.* from 
(
        SELECT 
                    5                   AS prod_id,
                    1                   AS attr_id, 
                    中国出版社         AS attr_value

        UNION

        SELECT 
                    5                   AS prod_id,
                    2                   AS attr_id,
                    清华出版社         AS attr_value
) AS A

表结构

技术分享

 

mysql insert插入新形式,再也不需要拼接多重insert啦

标签:

人气教程排行