Hi y'all,
I have a performance problem with a Query in a Paradox Database. I have the following tables (not exactly, just for the Idea)
Table A: 849 rows [ID, Name]
Table B: 27870 rows [ID, Integervalue, Date]
When I try to execute the following Query, the system doesn't react and I have to close the program in the task manager.
SELECT A.Name, B.Integervalue, MAX(B.Date)
FROM tableA A , tableB B
WHERE (A.Id = B.Id)
and B.date in (SELECT MAX(C.date)
FROM tableB C
WHERE C.Id = A.Id)
GROUP BY A.Name, B.Integervalue
ORDER BY A.Name ASC, B.Integervalue ASC
When I don't use the subquery, I get more than 1 result a name... (actually I get count(B.Integervalue) results). Does someone can help me??
Thanks in Advance.