Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.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_Database - Fatal编程技术网

Php 从多个表复制数据并插入到一个表中?

Php 从多个表复制数据并插入到一个表中?,php,mysql,database,Php,Mysql,Database,我想从多个表复制数据并插入同一数据库中的一个表中。如何使用PHP和MySQL执行相同的操作?为了与您的问题一样通用,请使用一个示例insert查询: insert into table3(col1, col2, col3, col4) select t1.col1, t1.col2, t2.col1, t2.col2 from table1 t1, table2 t2 where t1.idColumn = t2.colID 您应该添加一些关于数据结构和操作目标的信息。答案取决于很多因素。

我想从多个表复制数据并插入同一数据库中的一个表中。如何使用PHP和MySQL执行相同的操作?

为了与您的问题一样通用,请使用一个示例insert查询:

insert into table3(col1, col2, col3, col4) select t1.col1, t1.col2, t2.col1, t2.col2 from table1 t1, table2 t2 where t1.idColumn = t2.colID

您应该添加一些关于数据结构和操作目标的信息。答案取决于很多因素。