如果两个表列不匹配,我该如何匹配 [英] How Can I Match If Two Tables Columns Are Not Match

查看:104
本文介绍了如果两个表列不匹配,我该如何匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用两张桌子,即EMPLOYEE(ID,ECODE,DEPT)和DEPARTMENT(ID,DEPARTMENTNAME),

我的桌子



员工部



ID Ecode Dept ID deptName

1 10 1 1管理员

2 20 2 2产品

3 3 3账户

4 40 5

5 50 3

6 60 3
7 70 4

8 80 5

9 90 6

10 100 2





这里我想要与员工(ID)和员工(DEPT)相匹配......

我该怎么办呢? />


感谢您的建议并为我花费大量时间

Here i am using two table namely EMPLOYEE(ID,ECODE,DEPT) and DEPARTMENT(ID, DEPARTMENTNAME),
My table

Employee Department

ID Ecode Dept ID deptName
1 10 1 1 Admin
2 20 2 2 prodn
3 30 3 3 Accounts
4 40 5
5 50 3
6 60 3
7 70 4
8 80 5
9 90 6
10 100 2


here i want to match DEPARTMENT(ID) with EMPLOYEE (DEPT)......
how can i do it

Thanks for Advice and spend your gloden time for me

推荐答案

尝试使用内部加入 [ ^ ]



Try this using Inner Join[^]

select e.*,d.* from Employee e inner join Department d on e.dept = d.ID


您好,请尝试此查询,



从员工中选择* e $>
内部加入部门d在d.ID = e.dept
Hi try this Query,

Select * from Employee e
Inner Join Department d on d.ID = e.dept


这篇关于如果两个表列不匹配,我该如何匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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