简体   繁体   中英

Joining table A and table B, both having column1 as common

I have 2 tables - TableA and TableB . Both have column1 as common column.

But in TableA data in column1 is numeric like 201 and in TableB data in column1 is in words like 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 ?

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. One such example is number_to_string function found on this post.

Converting Numbers to Words in MYSQL result! 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.

First, it would be appropriate to have some function which convert integer to words, and then you can use standard join clause.

This link can help you

or

this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM