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

后端 未结 25 1977
灰色年华
灰色年华 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:38

    One approach would be to store the conditions in a temp table (or table variable in SQL Server) and join to that like this:

    SELECT t.SomeField
    FROM YourTable t
       JOIN #TempTableWithConditions c ON t.something LIKE c.ConditionValue
    

提交回复
热议问题