Compare Columns Where One is Similar to Part of Another

后端 未结 7 1367
再見小時候
再見小時候 2020-12-05 07:35

I\'m trying to write a Select statement where I can see if one column is like part of another.

tblNames 
ID    FullName                   FirstName
1     Mr.         


        
相关标签:
7条回答
  • 2020-12-05 08:08

    Oracle expects number when + is used. For string, please use the samle below :

    SELECT ID, FullName, FirstName
    FROM tblNames
    WHERE FullName like '%' || FirstName||'%'
    

    To compare one column of a table to a column of another table, please do the following

    select a.*,table_2_col_1, table_2_col_2 from (select table_1_col_1, table_1_col_2 from table_1 where
    )  a, table_2 where   table_1_col_1 like '%' || table_2_col_1 ||'%'
    
    0 讨论(0)
提交回复
热议问题