[英]Joining table A and table B, both having column1 as common
I have 2 tables - TableA
and TableB
. 我有2个表
TableA
和TableB
。 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
是数字像201
和TableB
数据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 要么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.