select lower(user.BYNAME) as USER_ID,user.USER_NAME,user.PASSWORD,user.USER_PRIV_NAME,department.DEPT_NAME from TD_OA.user,TD_OA.department where NOT_LOGIN!='1' and user.DEPT_ID = department.DEPT_ID
select department.DEPT_NO,department.DEPT_NAME,lower(user.BYNAME) as USER_ID,user.USER_NAME,user.USER_PRIV_NAME,user.EMAIL,user.MOBIL_NO from department left join user on department.DEPT_ID=user.DEPT_ID where department.DEPT_ID>0 or user.NOT_LOGIN<>'1' order by department.DEPT_NO,user.USER_PRIV_NO,user.USER_ID