Soner Gönül Soner Gönül - 1 month ago 7
SQL Question

Find similar data from different columns in Oracle

I have two columns like this. (TC_NO is 11 character, VER_NO is 10 character)

TC_NO VER_NO
19262512794 1926251279
31124177286 1111111111
31067179194 2222222222
65617278204 6561727820
31483188084 0000000000


What i want is, finding VER_NO's first 10 character is the same TC_NO's first 10 characters..

For example for this table the result should be:

TC_NO VER_NO
19262512794 1926251279
65617278204 6561727820


How can I do that in Oracle?

Answer
select *
from MYTABLE
where substr(TC_NO,1,10) = VER_NO
Comments