You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
369 B

/*
* 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'))