sql - How to query star (*) character in a field in where clause for mysql -


i want query table field contains star (*) character could't find valuable answer. tried below

where fieldname regexp '\*' 

there solutions using 'like' keyword wanna know way uses 'regexp' keyword.

thanks in advance.

you need escape backslash 1 more time since single backslash inside double or single quotes considered escape sequence.

where fieldname regexp '\\*' 

or

use character class.

where fieldname regexp '[*]' 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -