Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在表中插入数据并从另一个表中选择?_Php_Mysql_Select_Insert - Fatal编程技术网

Php 如何在表中插入数据并从另一个表中选择?

Php 如何在表中插入数据并从另一个表中选择?,php,mysql,select,insert,Php,Mysql,Select,Insert,我想这样做: My tb_b: --------------- B | C // Columns --------------- 'y' | 'z' // row --------------- 例如:在tb_a(a、b、c)值中插入('x',从tb_b中选择*) 我想要这个结果: My tb_a: ----------------- A | B | C // Columns ----------------- 'x' | 'y'

我想这样做:

My tb_b:
---------------
   B   |   C     // Columns
---------------
  'y'  |  'z'    // row
---------------
例如:在tb_a(a、b、c)值中插入('x',从tb_b中选择*)

我想要这个结果:

My tb_a:
-----------------
 A  |   B   |   C     // Columns
-----------------
'x' |  'y'  |  'z'    // row
-----------------

如何将tb_b中的数据和选定行插入表a?

tb_a(a,b,c)中a,b,c指的是什么?当tb_a中只有两列时,如何为3个字段插入?另外,
从tb_b中选择“x”,tb_b.b,tb_b.C
意味着选择第x行,b列和C列中的值
INSERT INTO tb_a (a, b, c)
SELECT 'x', tb_b.B, tb_b.C FROM tb_b