简体   繁体   English

MySql:SELECT字段值包含'和'吗?

[英]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 = '' . ~";:><?/\\!@#$%^*()_+|/ \\ ?' select * from Table1 where id = '' . ~";:><?/\\!@#$%^*()_+|/ \\ ?' ; ` ;`

Use LIKE in WHERE clause to check whether it contains single quotes( ' ) and double quotes( " ). WHERE子句中使用LIKE来检查它是否包含单引号( ' )和双引号( " )。

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 '%"%';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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