Why does using an Underscore character in a LIKE filter give me all the results?

后端 未结 6 1680
我在风中等你
我在风中等你 2020-11-29 00:52

I wrote the below SQL query with a LIKE condition:

SELECT * FROM Manager
WHERE managerid LIKE \'_%\'
AND managername LIKE \'%_%\'
6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 01:43

    You can write the query as below:

    SELECT * FROM Manager
    WHERE managerid LIKE '\_%' escape '\'
    AND managername LIKE '%\_%' escape '\';
    

    it will solve your problem.

提交回复
热议问题