mysql查询 - 包含?

时间:2010-08-12 14:35:16

标签: sql mysql database full-text-search mysql-error-1064

如何在mysql中搜索特定的字符串? 我尝试使用contains-给我错误:

SELECT r.name
     , r.network
     , r.namestring
     , i.name
     , r.rid
     , i.id
     , d.dtime
     , d.ifInOctets
     , d.description
FROM router AS r
INNER JOIN interface AS i ON r.rid = i.rid
INNER JOIN 1278993600_1_60 AS d ON i.id = d.id
                               AND d.dtime BETWEEN 1279027200 AND 1279029000
     WHERE r.network = "ITPN"
       AND i.status = "active"
       AND i.description CONTAINS ' DBK'

请帮忙。

4 个答案:

答案 0 :(得分:12)

尝试

AND i.description LIKE '% DBK%' 

答案 1 :(得分:5)

答案 2 :(得分:1)

使用like,即AND i.description LIKE'%DBK%'

答案 3 :(得分:1)

尝试

...AND i.description like '% DBK%'

...AND upper(i.description) like '% DBK%'

如果您希望获得DBKDbKdbkdBk,...

的任何内容