Skip to main content

Extração de Relatorio de Usuários no CrefazOn com APIKey

Usuários com APIKey no CrefazOn


select 
    b.Nome,
    b.[Login],
    d.nome as Matriz,
    MAX(a.Cadastro) as DataUltimoCadastro
from 
    proposta a with(nolock)
join 
    Seguranca.Usuario b with(nolock) on a.usuarioid = b.id and a.canalid = 3
join 
    seguranca.ApikeyUnidade c with(nolock) on b.UnidadeId = c.UnidadeId
join 
    unidade d with(nolock) on b.CorrespondenteId = d.CorrespondenteId and tipo = 0
where 
    b.Ativo = 1  and b.PessoaId is null and c.DataHoraVigenciaFim is NULL  
group by  
    b.Nome,b.[Login],d.Nome
order by 
    DataUltimoCadastro desc

Usuários com APIKey com o Log de ultima proposta cadastrada 

select 
    b.Nome,
    b.[Login],
    d.nome as Matriz,
    MAX(a.Cadastro) as DataUltimoCadastro
from 
    proposta a with(nolock)
join 
    Seguranca.Usuario b with(nolock) on a.usuarioid = b.id and a.canalid = 3
join 
    seguranca.ApikeyUnidade c with(nolock) on b.UnidadeId = c.UnidadeId
join 
    unidade d with(nolock) on b.CorrespondenteId = d.CorrespondenteId and tipo = 0
where 
    b.Ativo = 1  and b.PessoaId is null and c.DataHoraVigenciaFim is NULL  
group by  
    b.Nome,b.[Login],d.Nome
order by 
    DataUltimoCadastro desc