where 实施部门1 is not null or 实施部门2 is not null

解决方案 »

  1.   

    http://bbs.csdn.net/topics/390979522
    看一下这个帖子,类似的问题,可以参考一下
      

  2.   

    什么意思?我说的or方法是实施部门1 =‘要查的部门名称’or 实施部门2 =‘要查的部门名称’or ...这样的,这样就是查出来你要查的部门的单
      

  3.   

    也可以这样写:
    where 实施部门1||实施部门2||实施部门 is not null
      

  4.   

    什么意思?我说的or方法是实施部门1 =‘要查的部门名称’or 实施部门2 =‘要查的部门名称’or ...这样的,这样就是查出来你要查的部门的单 这样的确查到了啊,但是有重复的数据啊,,在楼下我把oracel语句贴出来吧
      

  5.   

    select t.newid id,
           t.title,
           t.name,
           t.contact,
           t.extensionnum,
           t.telephone,
           t.enforcementdepartments1,
           t.contact1,
           t.extensionnum1,
           t.telephone1,
           t.enforcementdepartments2,
           t.contact2,
           t.extensionnum2,
           t.telephone2,
           t.enforcementdepartments3,
           t.contact3,
           t.extensionnum3,
           t.telephone3,
           t.enforcementdepartments4,
           t.contact4,
           t.extensionnum4,
           t.telephone4,
           t.enforcementdepartments5,
           t.contact5,
           t.extensionnum5,
           t.telephone5,
           t.range,
           code,
           usernum,
           accord,
           t.newtype,
           description,
           starttime,
           endtime,
           newcontent,
           subtitles,
           bulletin,
           ivr,
           notes,
           state,
           creatcard,
           creattime,
           actualtime,
           decode(, 1, '提前', 2, '延时', 3, '警告', 0, '正常') ,
           card,
           operationtime,
           stime,
           etime,
           newcontentb,
           feedbackcard,
           reviewer,
           feedbacktime,
           decode(newtypeb, 1, '审核', 2, '反馈', 3, '调整') newtypeb,
           closecard,
           closereason
      from (select a.*,
                   b.*,
                   c.*,
                   a.id newid,
                   a.type newtype,
                   a.content newcontent,
                   b.content newcontentb,
                   b.type newtypeb,
                   row_number() over(partition by a.id order by a.creattime desc) r1
              from network_checkin a, network_adjustlog b, network_department c
             where a.id = b.id(+)
               and a.enforcementdepartments = c.deptid) t
     where r1 = 1
       and name = '技术部'
        or enforcementdepartments1 = '9'
        or enforcementdepartments2 = '9'
        or enforcementdepartments3 = '9'
        or enforcementdepartments4 = '9'
        or enforcementdepartments5 = '9'
     order by t.creattime desc
      

  6.   

    什么意思?我说的or方法是实施部门1 =‘要查的部门名称’or 实施部门2 =‘要查的部门名称’or ...这样的,这样就是查出来你要查的部门的单 这样的确查到了啊,但是有重复的数据啊,,在楼下我把oracel语句贴出来吧
    所有都重复吗?如果都重复就distinct一下。
    另外还要看一下为什么重复,具体看下表关联是否缺少条件