oracle SQL语句

来源:百度知道 编辑:UC知道 时间:2024/05/22 01:05:51
一个字段里面值是 123fda
123dfd
123fdf
以此类推....
我不想查询所有以123开头的,应该怎么写?
谢谢

select * from tablename where field not like '123%'

select * from tablename where field not like '123%' ;
select * from test where substr(test_col,1,3) <> '123';
都可以做,但是从性能方面考虑,如果该字段有索引,应该要用:

select * from tablename where field not like '123%' ;
最好

select * from test where substr(test_col,1,3) <> '123';