select t2.fauthgroupname, t4.fappname, t4.fnote, t4.id, t4.moduleid, t4.systemid
from tenterprise_users t1
       inner join tauthgroup t2 on t1.siteid = t2.siteid and t1.tauthgroupid = t2.tauthgroupid
       inner join tauthgroup_apps t3 on t2.siteid = t3.siteid and t2.tauthgroupid = t3.tauthgroupid
       inner join system_apps t4 on t3.system_appsid = t4.system_appsid and t4.fisused=1
where t2.fisused = 1
  and t1.fisadministrator = 1
  and t1.siteid = $siteid$
  and t1.tenterprise_userid = $tenterprise_userid$