2

I have a table (let's call it A) with a text field called references_int which has numerous values. One example is 'internal\reference[111]'.

If I do

SELECT * 
FROM A 
WHERE references_int LIKE 'internal\\reference[111]'

it will return zero rows. But if I replace LIKE with = it works.

I use a framework that simplifies find queries, but it uses LIKE.. Is there a way for it to work?

No idea if it's a bug or a feature.

Thanks!

4

1 回答 1

5

逃脱每个\

SELECT * 
FROM A 
WHERE references_int LIKE 'internal\\\\reference[111]'

默认情况下,如果您不指定ESCAPE字符LIKE\则假定为 , 根据文档。另一种方法是使用不同的ESCAPE字符:

SELECT * 
FROM A 
WHERE 'internalrefer\\ence[111]' LIKE 'internalrefer\\ence[111]' ESCAPE '#'
于 2012-08-27T23:18:34.100 回答