Is there a combination of “LIKE” and “IN” in SQL?

后端 未结 25 1630
灰色年华
灰色年华 2020-11-22 03:08

In SQL I (sadly) often have to use \"LIKE\" conditions due to databases that violate nearly every rule of normalization. I can\'t change that right now. But tha

25条回答
  •  别跟我提以往
    2020-11-22 03:48

    In Teradata you can use LIKE ANY ('%ABC%','%PQR%','%XYZ%'). Below is an example which has produced the same results for me

    --===========
    --  CHECK ONE
    --===========
    SELECT *
    FROM Random_Table A
    WHERE (Lower(A.TRAN_1_DSC) LIKE ('%american%express%centurion%bank%')
    OR Lower(A.TRAN_1_DSC) LIKE ('%bofi%federal%bank%')
    OR Lower(A.TRAN_1_DSC) LIKE ('%american%express%bank%fsb%'))
    
    ;
    --===========
    --  CHECK TWO
    --===========
    SELECT *
    FROM Random_Table  A
    WHERE Lower(A.TRAN_1_DSC) LIKE ANY 
    ('%american%express%centurion%bank%',
    '%bofi%federal%bank%',
    '%american%express%bank%fsb%')
    

提交回复
热议问题