How can I replace IDs in rows with another text in another table
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:
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,
LONDON, Victoria, 221B.
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:
http://www.tizag.com/mysqlTutorial/mysqljoins.php
http://mysqljoin.com/joins/inner-join-tutorial/
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.
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.
精彩评论