简体   繁体   中英

MySql: SELECT where a field value contains ' and "?

I want to retrieve a record where the value contains single quote and double quote.

Tried The following:

select * from Table1 where id = '' . ~";:><?/\\!@#$%^*()_+|/ \\ select * from Table1 where id = '' . ~";:><?/\\!@#$%^*()_+|/ \\ ?' ; `

Use LIKE in WHERE clause to check whether it contains single quotes( ' ) and double quotes( " ).

Query

select * from `your_table_name`
where `id` like '%''%'
or `id` like '%"%';

Find a demo here

select * from table1 where name like "%'%" OR name like '%"%';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM