1

Value is a string which contains alphanumeric characters and special characters also. And I am trying to display values which contains '%'.

GMB
  • 216,147
  • 25
  • 84
  • 135
SOURABH
  • 21
  • 6
  • 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 Answers2

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
0

Another way (though perhaps not faster):

WHERE val REGEXP('%')
Rick James
  • 135,179
  • 13
  • 127
  • 222