SQL Oracle使用String作为数字

时间:2022-01-19 15:46:41

I got table for an Oracle database.

我得到了一个Oracle数据库表。

This table is called TABLE1 with two columns.

该表称为TABLE1,有两列。

Table 1:

numberValue         wordValue

    1               Auto
    3               LKW
    4               Boot
    6               Fahrrad
    7               E-Auto

In my output I have a column that gives numbers back (not from table 1) - now I want that this numbers are replaced by the values in table1.wordValue.

在我的输出中,我有一个列可以返回数字(不是从表1中) - 现在我希望这些数字被table1.wordValue中的值替换。

How can I do this?

我怎样才能做到这一点?

Thanks!

1 个解决方案

#1


0  

Like mentioned in the comments, a simple join condition will give you your desired result:

如评论中所述,简单的连接条件将为您提供所需的结果:

SELECT wordValue 
FROM TABLE1 JOIN TABLE2
     ON TABLE1.numberValue=TABLE2.attr;

Change TABLE2 to the table where the output is coming from and attr to the attribute of the table

将TABLE2更改为输出来自的表,将attr更改为表的属性

#1


0  

Like mentioned in the comments, a simple join condition will give you your desired result:

如评论中所述,简单的连接条件将为您提供所需的结果:

SELECT wordValue 
FROM TABLE1 JOIN TABLE2
     ON TABLE1.numberValue=TABLE2.attr;

Change TABLE2 to the table where the output is coming from and attr to the attribute of the table

将TABLE2更改为输出来自的表,将attr更改为表的属性