开发者

Find fields with certain characters

开发者 https://www.devze.com 2022-12-27 04:09 出处:网络
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.;

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

精彩评论

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