CREATE OR REPLACE VIEW compte_unix_groupe_unix AS SELECT attribut_compte_unix.compte_unix_id, attribut_groupe_unix.groupe_unix_id FROM attribut_compte_unix, attribut_groupe_unix WHERE  attribut_compte_unix.attribut_id =  attribut_groupe_unix.attribut_id;

SELECT C.uid, G.gid; FROM compte_unix C JOIN attribut_compte_unix AC ON (AC.compte_unix_id = C.id) JOIN attribut A ON (A.id = AC.attribut_id) JOIN attribut_groupe_unix AG ON (AG.attribut_id = A.id) JOIN groupe_unix G ON (G.id = AG.groupe_unix_id) GROUP BY C.uid, G.gid;

CRETAE OR REPLACE VIEW groupmember AS SELECT C.uid, C.username, G.gid
FROM compte_unix C JOIN attribut_compte_unix AC ON (AC.compte_unix_id = C.id) JOIN attribut A ON (A.id = AC.attribut_id) JOIN attribut_groupe_unix AG ON (AG.attribut_id = A.id) JOIN groupe_unix G ON (G.id = AG.groupe_unix_id) GROUP BY C.uid, G.gid, C.username;
