SQL join on two columns with different format -


i have column in table1 numbers

      id       4-157-802        354-332       33-989-083       5-525-688  

i have column in table2 same numbers without dash (-)

      id       4157802        354332       33989083       5525688  

i tried writing join statement join these tables based on these 2 columns follows, not working.

select * table1 table1.id = table2.id , table2.id in ('5525688') 

need problem. appreciated.

select table1.*  table1 join table2  on replace(table1.id,'-','') = table2.id 

you can try using replace function.


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -