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

解决方案 »

  1.   

    [code=SQ]update s_sell join s_user on s_sell.userId = s_user.id
    set s_sell.house = 'h3'
    where s_user.company = 3;[/code]
      

  2.   

    [code=SQ]
    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]
      

  3.   

    1楼的可以了
    update s_sell  left  join s_user on s_sell.userId = s_user.id set s_sell.name= 'h4'  where s_user.company = 100 
      

  4.   

    这个还要看数据库吧.. PostgreSQL貌似就不支持这个..