[英]How can I write a select statement for mysql where I only do not want the second letter in the string?
I am trying to write a select
statement for mysql
where I want to exclude all strings that contain an 'a'
as the second letter. 我正在尝试为
mysql
写一条select
语句,其中要排除所有包含'a'
作为第二个字母的字符串。 Here is my select statement so far. 到目前为止,这是我的选择语句。 It works for the most part, but some still slip through for reason I do not understand.
它在大多数情况下都有效,但是由于我不明白的原因,仍然有些漏掉了。
Select title, replacement_cost, rating from film where title not like "-a%" and replacement_cost = 19.99
Use the underscore as wildcard for a single character: 使用下划线作为单个字符的通配符:
Select title, replacement_cost, rating
from film
where title not like "_a%"
and replacement_cost = 19.99
Select title, replacement_cost, rating
from film
where SUBSTR(title, 2, 1) <> 'a'
and replacement_cost = 19.99
请尝试这个
Select title, replacement_cost, rating from film where substr(title,2,1)!='a' and replacement_cost = 19.99
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.