【发布时间】:2016-01-07 11:53:10
【问题描述】:
如何在 SQL 中使用 LIKE 从列中选择包含子字符串“n'th\product_table”的所有字符串?
示例:- 1)有一个table1,里面有如下数据
column1
_ _
"from n'th\product_table of period"
"from n'th\product$table of period"
"for of n'th\groduct$table of people"
"to n'th\product_table of classes"
"change n'th\producttable of record"
"correct n'thproduct_table of value"
谁能给出一个使用 LIKE 运算符的 SQL 查询给出包含子字符串“n'th\product_table”的所有字符串的结果
预期结果
column1
_ _
"from n'th\product_table of period"
"to n'th\product_table of classes"
【问题讨论】:
-
样本数据和期望的输出可以很好地提供准确的答案,不要浪费时间去猜测。
-
where col like '%n''th\product_table%' -
@TonyAndrews 但它也会从 n'th\product$table of period 中选择该行,这不会发生
-
'%n''th\product\_table%'
-
@mnv 但它也会选择 for of n'th\groduct$table of people 的行,这不会发生跨度>