php - mysql 表字段问题
过去多啦不再A梦
过去多啦不再A梦 2017-05-16 13:00:36
0
3
343

有个问题,我有一张 A表和B表,A表是主表,用于存放主要信息,B表是附加表,存放次要信息,请问我怎么把B表的其中一个字段 带上字段中的值复制到主表中?

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
迷茫
UPDATE A INNER JOIN B ON A.id = B.id SET A.a = B.b;

A.id = B.id: the associated fields of the two tables;
A.a: the field that receives the data from table B;
B.b: the field that will be copied to table A.

过去多啦不再A梦

First you need to add this field to table A, and then update the joint table
Or you can create a view for them if you need a simple query

过去多啦不再A梦

A relates to B, join table query

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!