将一个表中的值替换为另一表中的值 [英] replacing a value from one table with the corresponding in other table

查看:90
本文介绍了将一个表中的值替换为另一表中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个oracle表

一个表有一个名为item
的列
在第二张表中,我有项目和代码

在使用select *从表1中选择值的同时,我想用第二个表中的相应代码替换该项目



请帮助

在此先感谢

asok

i am having 2 oracle table

one table is having one column named item

in the second table i am having item and code

while selecting the values from table one using select * i want to replace the item with their corresponding code from second table



please help

thanks in advance

asok

推荐答案

我认为您的意思是希望对这些列进行联接.您想要来自table2的代码列用于table1中的每个项目.像这样的东西:
I think you mean you want do do a join on those columns. You want the code column from table2 for every item in table1. Something like this:
select table2.code 
   from table2
   inner join table1 on table1.item = table2.item;


http://www.orafaq.com/wiki/Equi_join [


http://www.orafaq.com/wiki/Equi_join[^]

Good luck!


这篇关于将一个表中的值替换为另一表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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