如何将行中的ID替换为另一个表中的另一个文本

时间:2021-06-16 21:08:34

I have a datasheet (I can use it as CSV file, Excel worksheet or MySQL database) with RID, CID, and NAME fields. RID and CID fields contains a number which refer another row in another table. For an example, here is one row:

我有一个数据表(我可以用它作为CSV文件,Excel工作表或MySQL数据库)与RID,CID和NAME字段。 RID和CID字段包含一个引用另一个表中另一行的数字。例如,这里有一行:

5, Victoria, 12.

In another table, I have "5, LONDON" and in yet another table, it has "12, 221B" text. What I need to do is, replace 5 with "London" text and 12 with "221B" text so that row will be,

在另一张表中,我有“5,LONDON”,而在另一张表中,它有“12,221B”文字。我需要做的是,用“伦敦”文本替换5,用“221B”文本替换12,这样行就是,

LONDON, Victoria, 221B.

2 个解决方案

#1


2  

I believe, you are looking for the JOIN statementm. I am not sure what language you are using, but take a look at this links:

我相信,你正在寻找JOIN声明。我不确定您使用的是哪种语言,但请查看以下链接:

http://www.tizag.com/mysqlTutorial/mysqljoins.php

http://mysqljoin.com/joins/inner-join-tutorial/

#2


0  

What language are you planning to use?

你打算用什么语言?

If you are using SQL, you are pretty much limited to the data that is loaded into database tables or "poses" as database columns.

如果您使用的是SQL,则几乎只限于加载到数据库表中的数据或作为数据库列“构成”的数据。

If you are using a common purpose 3GL like C, C++ or Java, you also get an option to implement an analog of join by yourself. If the lookup tables/data sets are small, you can arrange them in maps and do translation this way.

如果您使用的是通用目的3GL,如C,C ++或Java,您还可以选择自己实现连接模拟。如果查找表/数据集很小,您可以在地图中排列它们并以这种方式进行翻译。

#1


2  

I believe, you are looking for the JOIN statementm. I am not sure what language you are using, but take a look at this links:

我相信,你正在寻找JOIN声明。我不确定您使用的是哪种语言,但请查看以下链接:

http://www.tizag.com/mysqlTutorial/mysqljoins.php

http://mysqljoin.com/joins/inner-join-tutorial/

#2


0  

What language are you planning to use?

你打算用什么语言?

If you are using SQL, you are pretty much limited to the data that is loaded into database tables or "poses" as database columns.

如果您使用的是SQL,则几乎只限于加载到数据库表中的数据或作为数据库列“构成”的数据。

If you are using a common purpose 3GL like C, C++ or Java, you also get an option to implement an analog of join by yourself. If the lookup tables/data sets are small, you can arrange them in maps and do translation this way.

如果您使用的是通用目的3GL,如C,C ++或Java,您还可以选择自己实现连接模拟。如果查找表/数据集很小,您可以在地图中排列它们并以这种方式进行翻译。