首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

update 语句要如何写

2012-02-10 
update 语句要怎么写updatetmp1setq2w2whereq1like%w1%为错误请指教两张表tmp1tmp2tmp1有两列(q1q2)tmp2

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)

热点排行