/* * Inclui o administrador em todos os grupos */ insert into pbx_grupo_usuario(user_id, gp_id) select (select id from pbx_usuarios where apelido = 'administrador') as user_id, gp_id from pbx_grupo a where user_id = 0 and not exists(select '' from pbx_grupo_usuario where gp_id = a.gp_id and user_id = (select id from pbx_usuarios where apelido = 'administrador'))