1

我正在尝试为要排除所有包含作为第二个字母的字符串select的位置编写语句。到目前为止,这是我的选择声明。它在大多数情况下都有效,但由于我不明白的原因,有些仍然会通过。mysql'a'

Select title, replacement_cost, rating from film where title not like "-a%" and replacement_cost = 19.99
4

2 回答 2

2

使用下划线作为单个字符的通配符:

Select title, replacement_cost, rating 
from film 
where title not like "_a%" 
and replacement_cost = 19.99

SQL 通配符

或与SUBSTR

Select title, replacement_cost, rating 
from film 
where SUBSTR(title, 2, 1) <> 'a'
and replacement_cost = 19.99
于 2013-09-18T09:50:54.840 回答
0

请试试这个

Select title, replacement_cost, rating from film where substr(title,2,1)!='a' and replacement_cost = 19.99
于 2013-09-18T09:49:39.583 回答