Problem with subquery

F

Frank Dulk

I have a table (Tab_Animal)com the following fields:

[cod_animal],[data] and [it fills up]

Every time that an animal lot seedling, should find out the fields of this
table.

I need to determine the entrance date and exit of an animal in the lots.

The consultation should have the following fields:
[cod_animal],[data_entrada],[data_saida] and [it fills up]

I made the following attempt:

SELECT [Tab_Animal].cod_Animal, [Tab_Animal].data AS data_entrada,
[Tab_Animal].data AS data_saida,[Tab_Animal].lote
FROM [Tab_Animal]
WHERE ((([Tab_Animal].data)=(Select(MIN(t.[data])) FROM [Tab_Animal] as t
WHERE ((t.[cod_Animal]=[Tab_Animal].[cod_Animal]) AND
((t.[data])>([Tab_Animal].[data]))))));

But the consultation comes back empty. Does anybody can me to help to find
where this the mistake?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

can't find the right query 0
Mail Merge query 1
Subquery? 4
Subquery 2
Query null value problem 2
Subquery Help 1
Subquery doesn't return GUIDs 2
Subquery Correllated In Select Clause - Is this possible? 3

Top