sql group by

外連接 

select  d.user_id,d.user_realname,u.fax,u.userphone,u.office_phone,u.room_num,
           (select decode(count(*),'0','受權查看','取消受權') 
             from oa_userbigrole r
            where r.user_id = d.user_id
              and r.bigrole_name='信訪_電話查看') as isRight
    from oa_user d
   outer join oa_department_user u
      on d.user_id = u.user_id
      where ('' = null or
                     user_realname like '%' || '' || '%')
                 and ('' is null or u.dep_code = '')
      group by d.user_id,d.user_realname,u.fax,u.userphone,u.office_phone,u.room_num
相關文章
相關標籤/搜索