在 MySQL 列中查找双引号 [英] Find double quotes in MySQL column

查看:84
本文介绍了在 MySQL 列中查找双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用双引号查找数据.我有下一个简单的查询:

I want to find data with double quotes. I have the next simple query:

SELECT * FROM table_name WHERE column_name LIKE "%\"%";

但我有语法错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"%\"%' at line 1

我应该怎么做才能找到带有双引号 (") 的数据?

What should I do to find this data with double quotes(")?

推荐答案

因为 LIKE 运算符本身使用 \ 字符,所以当您使用它来转义另一个字符(如双引号)时,必须将其加倍.

Because the \ character is used by the LIKE operator itself you have to double it when you use it to escape another character like the double quote.

见这里

SELECT * FROM table_name WHERE column_name LIKE "%\\"%";

应该适合你.

将改变单引号的双引号以括住文字

as will changing out the double quotes for single quotes to enclose the literal

SELECT * FROM table_name WHERE column_name LIKE '%"%';

正如您在此处

这篇关于在 MySQL 列中查找双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆