我正在尝试为 mysql
编写一个 select
语句,我想在其中排除所有包含 'a'
作为第二个的字符串信。到目前为止,这是我的选择语句。它在大多数情况下都有效,但由于我不明白的原因,有些仍然会漏掉。
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 title not like "_a%"
and replacement_cost = 19.99
或使用 SUBSTR
Select title, replacement_cost, rating
from film
where SUBSTR(title, 2, 1) <> 'a'
and replacement_cost = 19.99
关于mysql - 我怎样才能为 mysql 编写一条 select 语句,而我只不需要字符串中的第二个字母?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18868923/