mysql select 'name',id from table_b; //'name' 不在table_b表中 +------+-----------+ | name | id | +------+-----------+ | name | 123456 | | name | 1234567 | | name | 12345678 | | name | 123456789 | +------+-----------+ 4 rows in set (0.00
+------+-----------+
| name | id |
+------+-----------+
| name | 123456 |
| name | 1234567 |
| name | 12345678 |
| name | 123456789 |
+------+-----------+
4 rows in set (0.00 sec)
复制代码 代码如下:
mysql> insert into table_a(name,b_refer) select 'name', id from table_b; //'name' 不在table_b表中
Query OK, 4 rows affected (0.03 sec)