时间:2021-07-01 10:21:17 帮助过:4人阅读
可以先查询出来
select two.name2 as s,one.name1 as f,p_id as myid from two,one where two.p_id=one.id;
$res = f/s;
update two set name2=$res where p_id = myid;
这3条怎么用啊?我mysql菜鸟。
update two inner join one set two.name2=one.name1/two.name2 on two.p_id=one.id
update two inner join one set two.name2=one.name1/two.name2 on two.p_id=one.id
运行没反映啊。
update two join one on two.p_id=one.id set name2= concat(name2,'/',name1)
谢谢,成功了。
$sql="update two,one set two.name=concat(one.name,'/',two.name) where one.id=two.p_id";刚才试了下,这样也可以。要用到concat这个函数。