drop view vw_derechosgrupos
go

CREATE VIEW vw_derechosgrupos
AS
--autor: gustavo duffoo
--devuelve los derechos de los grupos
SELECT se_accessdetrights.screenid, se_usergroup.userid, 
    se_accessrights.type, se_accessdetrights.deleterights, 
    se_accessdetrights.insertrights, 
    se_accessdetrights.updaterights, 
    se_accessdetrights.viewrights
FROM se_accessrights INNER JOIN
    se_accessdetrights ON 
    se_accessrights.userid = se_accessdetrights.userid INNER JOIN
    se_usergroup INNER JOIN
    se_grouprec ON 
    se_usergroup.groupid = se_grouprec.groupid ON 
    se_accessrights.userid = se_grouprec.groupid
WHERE (se_accessrights.type = 'G')