sql server 以模糊查找字段为条件进行联合查找

2024-12-03 02:13:04
推荐回答(1个)
回答1:

SQL code

SELECT * FROM TABLE1
WHERE
CASE WHEN COLUMN1 like '%小王%' THEN 1
ELSE
(CASE WHEN COLUMN2 like '%小王%' THEN 1
ELSE
(CASE WHEN COLUMN3 like '%小王%' THEN 1 ELSE 0 END)
END)
END =1