开发者

Find fields with certain characters

I'm trying to SELECT fields with multiple dots (开发者_运维问答 . ) in their value.

Exactly, I'm trying to find fields with a subdomain as an entry in domain column, e.g.;

SELECT * FROM domains WHERE ( number of dots in domain value bigger than 1 ).

Any suggestions ?


You could use

SELECT * FROM domains WHERE ( domain LIKE "%.%.%" ). 

See the MySQL Documentation for String functions for details.


You can use regular expressions:

SELECT * FROM domains WHERE domain REGEXP '\\.+'

Assuming you want the dots placed near each other: ...


The string functions don't seem to have anything in that vein, so you may need the REGEXP operator.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜