挿入し、別のテーブルにデータテーブルの一部をコピーします

多くの場合、固定値を含むことができるデータを挿入遭遇動作は、別のテーブルは、クエリの結果とすることができる
:2例問題解決すること
がある場合に1、表2に:

insert into table1 (x1,x2) values('a',(select x from table2 where x=x))

2、とき表2の不在:

insert into table1(x1,x2) select 'a' , x from table1 where where x=x

ます。https://www.jianshu.com/p/a9304c4c940dで再現

おすすめ

転載: blog.csdn.net/weixin_34066347/article/details/91190938