mysql中,
s_sell 表(房源表)
id userId(用户id) house(房源号)
1 11 h1
2 22 h2s_user 用户信息表
id name(名) company(公司号)
11 aa 3
22 bb 4现需,修改 公司号为3的用户的房源号为h3,如何实现呀,最好是用一个sql,thanks
s_sell 表(房源表)
id userId(用户id) house(房源号)
1 11 h1
2 22 h2s_user 用户信息表
id name(名) company(公司号)
11 aa 3
22 bb 4现需,修改 公司号为3的用户的房源号为h3,如何实现呀,最好是用一个sql,thanks
set s_sell.house = 'h3'
where s_user.company = 3;[/code]
update s_sell as s inner join s_user as u on s.id=u.id and u.company=3 set s.house='h3'
[/code]
update s_sell left join s_user on s_sell.userId = s_user.id set s_sell.name= 'h4' where s_user.company = 100