SELECT *从`线程`论坛 ID 不在 (1,2,3) 和 IF( LEFT( title, 1) = '#', 1, 0) 中按标题 ASC 排序
我有这个查询,如果它以# 开头,它将选择某些内容.我想要做的是,如果 # 作为一个值给出,它将查找数字和特殊字符.或者任何不是普通字母的东西.
我该怎么做?
如果要选择所有标题"不以字母开头的行,请使用 REGEXP:
SELECT *从线程论坛 ID 不在的地方 (1,2,3)和标题不是正则表达式 '^[[[:alpha:]]'按标题 ASC 排序
在 MySQL 手册中查找有关 REGEXP 的更多信息.>
SELECT *
FROM `thread`
WHERE forumid NOT IN (1,2,3) AND IF( LEFT( title, 1) = '#', 1, 0)
ORDER BY title ASC
I have this query which will select something if it starts with a #. What I want to do is if # is given as a value it will look for numbers and special characters. Or anything that is not a normal letter.
How would I do this?
If you want to select all the rows whose "title" does not begin with a letter, use REGEXP:
SELECT *
FROM thread
WHERE forumid NOT IN (1,2,3)
AND title NOT REGEXP '^[[:alpha:]]'
ORDER BY title ASC
Find more about REGEXP in MySQL's manual.
这篇关于MySQL - 如果它以数字或特殊字符开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!