update 可以与left join 一起用吗?
程序员文章站
2022-03-10 23:36:15
...
各位大神,我是这么写的,好像不对,能帮我改改吗?谢谢!
$query = "UPDATE a,b set a.sta = '3',b.scores='b.scores+a.pname' from `member_operation` WHERE aid = '$var' as a left join `member` as b on a.mid=b.mid ";
member_operation WHERE aid = '$var表和member表通过 a.mid=b.mid相联。
我想使得member_operation 表中的sta = '3',member表中的scores等于原有值加上member_operation 中pname值。
$query = "UPDATE a,b set a.sta = '3',b.scores='b.scores+a.pname' from `member_operation` WHERE aid = '$var' as a left join `member` as b on a.mid=b.mid ";
member_operation WHERE aid = '$var表和member表通过 a.mid=b.mid相联。
我想使得member_operation 表中的sta = '3',member表中的scores等于原有值加上member_operation 中pname值。
回复讨论(解决方案)
有人教我一下吗?谢谢大神。。。
UPDATE a,b set a.sta = '3',b.scores='b.scores+a.pname' from `member_operation` WHERE aid = '$var' as a left join `member` as b on a.mid=b.mid
UPDATE a,b set a.sta = '3',b.scores='b.scores+a.pname' from `member_operation` WHERE aid = '$var' as a left join `member` as b on a.mid=b.mid
UPDATE a,b set a.sta = '3',b.scores='b.scores+a.pname' from `member_operation` as a left join `member` as b on a.mid=b.mid WHERE a.aid = '$var' 试试这句吧 看看符合你需求么。。
好的 ,我试试,谢谢~!
上一篇: 小程序如何设置类目
下一篇: 如何获取小程序的unionid