Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.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 通过从两个表中获取值来更新表1_Php_Mysql - Fatal编程技术网

Php 通过从两个表中获取值来更新表1

Php 通过从两个表中获取值来更新表1,php,mysql,Php,Mysql,我正在使用mysql数据库 要通过从两个或多个表中获取值,在特定条件下更新表1吗 范例 table1 id | stdId | trId | std_name | std_lname |std_edu_college |std_edu_cource 01 | 1256 | 2341 | student table stdId | name | lname

我正在使用mysql数据库 要通过从两个或多个表中获取值,在特定条件下更新表1吗 范例

            table1 
            id | stdId | trId | std_name | std_lname |std_edu_college |std_edu_cource
            01 | 1256  | 2341 |



            student table
            stdId | name | lname 
            1256  |Mallu |Malage



            student_education table
            stdId | college | cource 
            1256  | BEC     | Engineering
想用学生和学生大学教育数据更新表1吗

像这样,我在表1中有大约100列具有不同的列名 我知道通过加入并设置每个受尊重的列来使用更新表1,但我想像循环或简易方式一样进行更新,所以有人请帮助我试试这一个

UPDATE `table1` as tbl
inner join student as std on tbl.stdId=std.stdId
inner join student_education as stdEd on tbl.stdId=stdEd.stdId
SET tbl.`std_name`=std.name
SET tbl.`std_lname`=std.lname
SET tbl.`std_edu_college`=stdEd.college
SET tbl.`std_edu_cource`=stdEd.cource
WHERE tbl.stdId=1256
我想它会帮助你解决你的问题。

可能的重复:可能的重复