Question
· Jul 22, 2021

Strange query result

Can someone tell me why this query 

select vet.ID, svp.ID_PACIENTE, vet.conselho, vet.uf, vet.numConselho, vet.nome, svp.SEQ_SOLICITANTE, vet.numConselho , vlab.numConselho
from RPE.Veterinario vet
inner join RPE.VeterinarioLab vlab
    ON vet.conselho = vlab.conselho
    AND vet.numConselho = vlab.numConselho
    AND vet.uf = vlab.uf
left join MySevi.SolicitanteVeterinarioPaciente svp
    on svp.ID_VETERINARIO = vet.ID
where svp.ID_PACIENTE in ('6408||284144||47633', '6408||284145||47634')

does't return any value and this query

select vet.ID, svp.ID_PACIENTE, vet.conselho, vet.uf, vet.numConselho, vet.nome, svp.SEQ_SOLICITANTE, vet.numConselho , vlab.numConselho
from RPE.Veterinario vet
inner join RPE.VeterinarioLab vlab
    ON vet.conselho = vlab.conselho
    AND vet.numConselho = vlab.numConselho
    AND vet.uf = vlab.uf
left join MySevi.SolicitanteVeterinarioPaciente svp
    on svp.ID_VETERINARIO = vet.ID
where svp.ID_PACIENTE in ('6408||284144||47633', '6408||284145||47634') and vet.numConselho > 0

does?

Discussion (4)1
Log in or sign up to continue

Try %ignoreindices * perheps you have a problem with the indices
If you get an result you must rebuild the indices.

select vet.ID, svp.ID_PACIENTE, vet.conselho, vet.uf, vet.numConselho, vet.nome, svp.SEQ_SOLICITANTE, vet.numConselho , vlab.numConselho

from %ignoreindices * RPE.Veterinario vet

inner join RPE.VeterinarioLab vlab     ON vet.conselho = vlab.conselho    
AND vet.numConselho = vlab.numConselho   
AND vet.uf = vlab.uf
left join MySevi.SolicitanteVeterinarioPaciente svp     on svp.ID_VETERINARIO = vet.ID where svp.ID_PACIENTE in ('6408||284144||47633', '6408||284145||47634')