Menus
SQL - Como consultar interface do menu Eligo?
RTMENU.MENUS.FAQ-10322
Interfaces acessadas nos itens de menus
select mn.menu, it.nome as interface
,im.sequencia
,im.ativo
,mn.titulo as titulo_menu
,(select sm.menu from menus sm where sm.id = im.sub_menu_id) as submenu
from itens_menus im
join menus mn on mn.id = im.menu_id
left join interfaces_sistemas it on it.id = im.interface_id
order by mn.menu, im.sequencia, it.nome
;
Menus e sub-menus
select mn.menu
,im.sequencia
,im.ativo
,mn.titulo as titulo_menu
,(select sm.menu from menus sm where sm.id = im.sub_menu_id) as submenu
from itens_menus im
join menus mn on mn.id = im.menu_id
where im.interface_id is null
order by mn.menu, im.sequencia
;
Menus sem "pai"
select mn.menu
,mn.titulo
,mn.topo
from menus mn
where not exists
(select mn.id
from itens_menus im
where mn.id = im.menu_id)
order by mn.menu
;