Quantcast
Channel: Optimizing Query
Viewing all articles
Browse latest Browse all 4

Optimizing Query

0
0

Currently I have:

SELECT LCallRprt_Joind3.*
FROM LCallRprt_Joind3
WHERE (((LCallRprt_Joind3.Timestamp)=(Select Max([Timestamp])
From LCallRprt_Joind3 as C
Where C.Control_Number = LCallRprt_Joind3.Control_Number)));

LCallRprt_Joind3 is a union query with fields: Control_Number, PK, Timestamp, In/Out and Result.

I need the to select the most recent record for each Control_Number, and this query is really slow.

I'm trying to optimize the query, as I've noticed that the following runs seemingly instantaneously, with near the same results, but lacking fields: PK, In/Out, Result

SELECT Max(LCallRprt_Joind3.[timestamp]) AS TS, LCallRprt_Joind3.Control_Number
FROM LCallRprt_Joind3
GROUP BY LCallRprt_Joind3.Control_Number;





Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images