本帖最后由 binsea1 于 2012-06-14 13:07:19 编辑

解决方案 »

  1.   

    id det flag
    10011 1 null
    10021 null null
    1003A 2 A
    1003B 3 null
    1004A null A
    这样一个表,选出det不为空的,如果id末尾为A或B并且flag不为空的也选上,结果如下:

    id det flag
    10011 1 null
    1003A 2 A
      

  2.   

    where det is not null or (substr(id,-1) in ('A','B') and flag is not null)
      

  3.   

    楼上的这个条件我用了,结果会是:id det flag
    10011 1 null
    1003A 2 A
    1004A null A
      

  4.   

    where det is not null
      

  5.   


    where det is not null and((substr(id,-1) in ('A','B') and flag is not null )or substr(id,-1) not in ('A','B'))
      

  6.   

    where det is not null 
    and((substr(id,-1) in ('A','B') and flag is not null )or substr(id,-1) not in ('A','B'))
      

  7.   

    7楼,果然不错哦。
    我对这种or  and 搭配很头痛