Value is a string which contains alphanumeric characters and special characters also. And I am trying to display values which contains '%'.
Asked
Active
Viewed 877 times
1
-
Does this answer your question? [SQL 'LIKE' query using '%' where the search criteria contains '%'](https://stackoverflow.com/questions/10803489/sql-like-query-using-where-the-search-criteria-contains) – Mark Rotteveel May 29 '20 at 07:04
-
With the duplicate, for standard SQL solutions (instead of SQL Server specific solutions), look at - for example - [this answer](https://stackoverflow.com/a/10803697/466862). – Mark Rotteveel May 29 '20 at 07:06
2 Answers
2
You could just use string functions:
select val from mytable where locate(val, '%')
If you want to do this with like
, you need the escape
option:
select val from mytable where val like '%|%%' escape '|';

GMB
- 216,147
- 25
- 84
- 135
-
1select val from mytable where val like '%|%%' escape '|'; Worked for me. – SOURABH May 29 '20 at 04:26