update a set color=b.color from a,b,c where a.carid=c.xuhao and c.colorid=b.fid
update a set color=b.fid from a join (b join c on b.fid=c.colorid) on a.carid=c.xuhao
select * from c left join a on c.xuhao=a.carid left join b on c.colorid=b.fid
修正一点,楼主要在A表中直接写color,建议写colorID: update a set color=c.colorid from a join c on a.carid=c.xuhao
谢谢大力。顺便再问一个问题,如果我需要同时参照另外一个表d(象参照表b一样),是不是可以这样写: update a set color=b.color another=d.another from b,c,d where b.fid=c.colorid and a.carid=c.xuhao d.id=c.anotherid这里似乎不需要用什么inner join之类的东西,那么inner join什么的作用体现在什么地方那?
update a set color=c.colorid from a join c on a.carid=c.xuhao
update a set color=b.color another=d.another from b,c,d where b.fid=c.colorid and a.carid=c.xuhao d.id=c.anotherid这里似乎不需要用什么inner join之类的东西,那么inner join什么的作用体现在什么地方那?
on a.carid=D.xuhao