一张表test 其中有一个字段 tid number型 长度为四 
表中的记录数据tid 
4014
5014
6014
7014
8139
9098写一条查询语句查出以 14 结束的记录

解决方案 »

  1.   

    select * from test where tid like '%4';
    没记错应该是这样写的.
      

  2.   

    select * from test where tid like '__14'; 
      

  3.   

    正解,这个好像很基础啊,楼主。
    select * from test where tid like '%14'; 
      

  4.   


    SQL>select * from table where mod(tid, 100)=14;或者SQL>select * from table where to_char(tid) like '%14';
      

  5.   

    select * from test where tid like '%14'; 
    基础的东西
      

  6.   

    两种都可以 select * from test where tid like '%14'; select * from test where tid like '__14'; __ 是两个_
      

  7.   

    综合一下
      select * from test  where tid like '%14';
    select * from test  where tid like '__14';——两个_
    select * from test  where mod(tid,100) = 14;
    select * from test  where to_char(tid) like '%14';
      

  8.   

    select * from test where tid like '%4';
      

  9.   

    模糊查询,基础的东西
    select * from test where tid like '%14'; 
      

  10.   


    因为规定了长度,所以第2个也可以,‘%’‘_’是oracle 里面的两个通配符,前者表示任意多个字符,后者表示任意一个字符。
      

  11.   

    使用通配符  % 和 _都可以实现,like '%14' 或者 like '__14',如他们所说,是两个下划线
      

  12.   

    我也补充一个
    select * from test where substr(tid,-2)= '14'
      

  13.   

    SQL>select * from table where mod(tid, 100)=14; 或者 SQL>select * from table where to_char(tid) like '%14'
      

  14.   

    select * from table where to_char(tid) like '%14'
      

  15.   

    恩 在楼主这个数据表里
    select * from test where tid like '%4';
    select * from test where tid like '%14';
    select * from test where tid like '%014';

    都能达到过滤以 14 结束的记录。
      

  16.   

    不就是 模糊查询select * from tab where tid like '%14';
      

  17.   

    select * from test where tid like '%14'; 
    这个很基础!
      

  18.   

    SQL>select * from table where mod(tid, 100)=14; 或者 SQL>select * from table where to_char(tid) like '%14';
      

  19.   

    楼上的真是,简单的语句,这里太热情了呵呵select * from test where tid like '%14'; select * from test where tid like '__14'; 
      

  20.   

    select * from test where tid like '__14'; 
    这句最合适。四位长度嘛
      

  21.   

    select * from test where tid like '%4';
      

  22.   

    select tid from test where tid like '%14';
      

  23.   

    select tid from test where instr(tid,'14')>length(tid)-2
    再建基于函数的索引,效率应该可以提高