使用2个不同的数据库将数据从1个表中提取到另一个表中 [英] Etract data from 1 table to other table with 2 different database

查看:58
本文介绍了使用2个不同的数据库将数据从1个表中提取到另一个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是

我已从同一服务器上的不同数据库获取数据
进入我的数据库(仅选定的数据不能全部导入或导出)
(例如)
我的数据库名称Roaster和表名称超时

其他数据库名称HR和表employeesalary

所以我必须按employeeno(它也是
)从HR datbase选择员工薪水 存在于我的Roaster数据库表中)

我想将employeeno从Roaster传递给Hr datbase以提取记录
我该怎么办?

感谢

my issue is

i have get data from different database on same server
into my datbase ( only selected data not import or export all)
(e.g)
My db name Roaster and table name overtime

other db name HR and table employeesalary

so i have to pick employee salary from HR datbase by employeeno(its also
exist in my Roaster database table )

i want to pass employeeno to Hr datbase from Roaster to extract record
how can i do this ?

thanks

推荐答案

希望这对您有帮助
Hope this helps you
<pre lang="sql">

SELECT a.salary  FROM HR .dbo.employeesalary a inner join Roaster .dbo.overtime b  ON a.employeeno=b.employeeno</pre>


这篇关于使用2个不同的数据库将数据从1个表中提取到另一个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆