I have several queries that are causing the main query to run slow.
SELECT M.[Meter Name], R1.ReadingDate, R1.MeterReading, R2.ReadingDate AS PrevReadingDate, R2.MeterReading AS PrevMeterReading, [R1].[MeterReading]-([PrevMeterReading]+[R2].[Refill]) AS Use, Abs([Use]) AS TTLUsed, R2.Refill, R2.[Floride_Added_#]
FROM [Meter Information] AS M INNER JOIN ([Water Meter Readings] AS R1 LEFT JOIN [Water Meter Readings] AS R2 ON R1.frg_MeterID = R2.frg_MeterID) ON M.MeterID = R1.frg_MeterID
WHERE (((M.[Meter Name])="Fluoride") AND ((R2.ReadingDate)=(SELECT Max(R3.ReadingDate)
FROM [Water Meter Readings] AS R3
WHERE (R3.frg_MeterID = R1.frg_MeterID)
AND (R3.ReadingDate < R1.ReadingDate)
))) OR (((R2.frg_MeterID) Is Null))
ORDER BY M.[Meter Name], R1.ReadingDate;
Any help is appreciated.
Ken
Posted by: statmanbp@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar