如图:
表seven:
sid name sddress
1 hua kkk
2 guan ddd
3 hh lll
4 kkk yyy
~~~~~~~
表three:
tid name sdd
1 hua
3 hh
4 kkk
~~~~~~~~~~~~~~~~~~~~~`
怎么用sql语句把tid=sid的sddree值考到表three的字段sdd里?也就是three表最后的结果为:
表three:
tid name sdd
1 hua kkk
3 hh 111
4 kkk yyy
表seven:
sid name sddress
1 hua kkk
2 guan ddd
3 hh lll
4 kkk yyy
~~~~~~~
表three:
tid name sdd
1 hua
3 hh
4 kkk
~~~~~~~~~~~~~~~~~~~~~`
怎么用sql语句把tid=sid的sddree值考到表three的字段sdd里?也就是three表最后的结果为:
表three:
tid name sdd
1 hua kkk
3 hh 111
4 kkk yyy
解决方案 »
- 求一个查询语句
- exec master..xp_cmdshell 'bcp Vegatable.dbo.V_out out d:\qq.xls -c -q -s"zyp" -u"sa" -p"asdasd"'
- 大家帮忙看看,简单问题!
- SQL 38400 的值对于"value"无效 "Value"应介于"Minimum" 和"Maximum" 之间
- SQL数据库附加问题!
- 求一SQL语句,高手请进,急!!!!!!!!!!!,谢谢
- SQL Server 7.0安装方面的问题
- 数据库查询的问题:仅查询指定条数记录
- 如果做这个条件联接
- 如何不让烦人中文输入法不自动激活
- 向sqlserver2000中导入数据时,某些字段的值读不出来,断点显示是“inaccessible value”,导入时出错。该怎么处理?
- 简单的SQL问题
update three
set sdd=seven.sddress
from seven
where three.sid=seven.tid
declare @seven table(sid int, name varchar(10), sddress varchar(10))
insert @seven select 1, 'hua' , 'kkk'
insert @seven select 2, 'guan', 'ddd'
insert @seven select 3, 'hh' ,'lll'
insert @seven select 4, 'kkk' , 'yyy'
declare @three table(tid int, name varchar(10) ,sdd varchar(10))
insert @three select 1 ,'hua',null
insert @three select 3 ,'hh' ,null
insert @three select 4 ,'kkk',null
update t set sdd=s.sddress from @seven s inner join @three t on s.sid=t.tid
select * from @three
/*tid name sdd
----------- ---------- ----------
1 hua kkk
3 hh lll
4 kkk yyy
*/