第一个语句
select name from org_member where id not in (select member_id from logon_log)
第二个语句
select
a.id,c.name,d.name,b.name,a.name,a.org_department_id,a.org_level_id,a.org_account_id,a.org_post_id,
b.path,b.org_account_id,substr(b.path,0,(instr(b.path,'.',-1)-1))
from
org_member a left join org_department b on a.org_department_id=b.id
left join org_account c on c.id = a.org_account_id
left join org_department d on d.path = substr(b.path,0,(instr(b.path,'.',-1)-1))
and d.org_account_id = c.id
where a.id not in (select member_id from logon_log)
order by c.sort_id,b.sort_id,a.sort_id
建议改下,将org_department,org_account,org_department这三张表先关联起来组成表t,然后表org_member left join t
------解决方案--------------------
------解决方案--------------------
select a.id,c.name,d.name,b.name,a.name,a.org_department_id,a.org_level_id,a.org_account_id,a.org_post_id, b.path,b.org_account_id,substr(b.path,0,(instr(b.path,'.',-1)-1)) from org_member a ,org_department b , org_account c ,org_department d where a.id not in (select member_id from logon_log) and a.org_department_id=b.id and and c.id = a.org_account_id and d.path = substr(b.path,0,(instr(b.path,'.',-1)-1)) and d.org_account_id = c.id order by c.sort_id,b.sort_id,a.sort_id