Dana Shmulenson
Dana Shmulenson

Reputation: 1

SQL query - Join Two Sql Tables with different format

I have 2 Tables in my datebase. The first table called Table1 has a column called Fullnumber and contains 9 digits. The second table called Table2 has a column called Shortnumber and contains only the first 6 digits that appear in the Fullnumber column. How can i join the two tables together? There is no other matching column.

Thank you!

Upvotes: 0

Views: 90

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270301

You can use like:

from table1 join
     table2
     on table1.fullnumber like table2.shortnumber || '%'

Upvotes: 0

Related Questions