当前位置: 代码迷 >> Sql Server >> update 语句要如何写
  详细解决方案

update 语句要如何写

热度:89   发布时间:2016-04-27 20:33:02.0
update 语句要怎么写
update   tmp1
set   q2=w2
where     q1   like   '%w1% '  

为错误   请指教


两张表     tmp1   tmp2
tmp1   有两列   (q1   q2)        
tmp2   也有两列(w1   w2)
列q1   为6位   学号     q2   地址(空)
w1   为8位学号(第一位和第八位为附加码)     w2   为地址
现在要把tmp2的w2里的地址数据   更新到q2里
要怎么写




------解决方案--------------------
update temp1 set q2=w2
from temp1 a,temp2 b
where a.q1=substring(b.w1,2,6)
  相关解决方案