sql如何引用另一个表的一列值

更新时间:02-07 综合 由 桑稚 分享

SQL将一个表中的某一列值全部插入到另一个表中

插入的话:

insert into a(col) select col from b

更新的话:

update a set col=select col from b where a.id=b.id

判断表是否存在数据库中,存在就删除

if exists (select * from Sysobjects where name='temp')

begin

   drop table temp

end

insert into a(columens)

elect (columens) from b

希望对你有帮助。

声明:关于《sql如何引用另一个表的一列值》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/all/15_1566937.html