简体   繁体   English

连接表A和表B,两者均具有column1

[英]Joining table A and table B, both having column1 as common

I have 2 tables - TableA and TableB . 我有2个表TableATableB Both have column1 as common column. 两者都具有column1作为公共列。

But in TableA data in column1 is numeric like 201 and in TableB data in column1 is in words like two hundred one . 但在TableA中的数据column1是数字像201TableB数据column1是一样的话two hundred one

None of the other columns is common. 其他列均不常见。

How can I join these tables? 如何加入这些表格? Can I use to_char(todate(column1,'j'),jsp) for TableA ? 我可以对TableA使用to_char(todate(column1,'j'),jsp)吗?

In Oracle it is possible using this to_char function, but in SQL you will need to write a function for this conversion and then pass this function in your query. 在Oracle中,可以使用此to_char函数,但在SQL中,您将需要为此转换编写一个函数,然后在查询中传递该函数。 One such example is number_to_string function found on this post. 这样的例子之一就是在这篇文章中找到的number_to_string函数。

Converting Numbers to Words in MYSQL result! 在MYSQL中将数字转换为单词! Using Query 使用查询

Using this function you can write a condition like 使用此功能,您可以编写如下条件

number_to_string(TableA.numValue) = TableB.stringValue in your JOIN to obtain the desired results. JOIN中的number_to_string(TableA.numValue) = TableB.stringValue获得所需的结果。

First, it would be appropriate to have some function which convert integer to words, and then you can use standard join clause. 首先,有一些将整数转换为单词的函数比较合适,然后可以使用标准的join子句。

This link can help you 此链接可以为您提供帮助

or 要么

this link 这个连结

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 连接表A和B以获取两者的元素 - Joining Table A and B to get elements of both 两个共有2列的SQL表需要在表A中但不在表B中的记录(列1相同,但列2不同) - two SQL tables with 2 columns in common, need records that are in table A but not in table B (column 1 is same in both but different column 2) SQL将表B中的两个或多个与表A中的公共数据连接在一起 - SQL Joining Two or More from Table B with Common Data in Table A 如何在 SQL 服务器的两个表中从另一个表中添加一个表中的列? - How to add a column in a table from another table having common id column in both the tables in SQL Server? 拆分表并在没有公共列的情况下执行连接 - Split the table and perform joining without common column 将两个不同的表与公共列上的公共第三个表连接起来 - Joining two different tables with a common third table on a common column 创建新表并插入具有 column1=kermit(value) 和 status=completed(value) 的列 - Create new table and insert columns having column1=kermit(value) and status= completed(value) 通过连接表 B 和表 A 更新表 A - Update table A by Joining Table B and Table A 通过公用表联接表 - Joining tables through a common table 根据 SQL 表中 (A) 列中的常用值合并列 (B) 中的值 - Merge values in a column (B) based on common values in column (A) in SQL table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM