Okay, we can now see the query.
How is it giving different results:
- returning different records?
- returning a different number of records?
If you run it:
- on the same computer, twice in a row?
- if you run it on different computers?
I don't see anything in the query itself or its subquery that looks
ambiguous.
Hi,
Sorry... It's a Access database. the query is as follow:
SELECT t_resultadoslaboratorio.*
FROM ((t_paciente
LEFT JOIN t_adulto ON t_paciente.nid = t_adulto.nid)
LEFT JOIN t_crianca ON t_paciente.nid = t_crianca.nid)
INNER JOIN t_resultadoslaboratorio ON t_paciente.nid
= t_resultadoslaboratorio.nid
WHERE ((t_resultadoslaboratorio.nid Is Not Null)
AND (t_resultadoslaboratorio.dataresultado =
(select min(dataresultado)
from t_resultadoslaboratorio r
where t_paciente.nid = r.nid
and r.codexame = 'CD4'
and r.codparametro = 'Cd4 Absoluto'))
AND (t_paciente.emtarv = True)
AND (t_resultadoslaboratorio.codexame = 'CD4')
AND (t_resultadoslaboratorio.codparametro = 'Cd4 Absoluto'));
The table t_paciente has a one to one relationship with t_adulto e
t_crianca,
[quoted text clipped - 21 lines]