D
DawnTreader
Hello All
i have a query that builds a range of values to give me information on what
is kind of servicing is needed in those ranges. i built this based on the
information from this page: http://allenbrowne.com/ser-58.html
my code for that query looks like this:
SELECT RT.IntervalHours AS Minimum, (SELECT MIN(RT1.IntervalHours)
FROM tblRebuildIntervals AS RT1
WHERE RT1.IntervalHours > RT.IntervalHours) AS Maximum, RT.r1000hr,
RT.r5000hr, RT.r10000hr, RT.r15000hr, RT.r20000hr, RT.r25000hr
FROM tblRebuildIntervals AS RT;
the interval hours is the amount of time that the machine in question has
been running, the r1000hr and others are the service interval requirements
for the ranges.
now i have another query that finds the products running hours. that looks
like this:
SELECT tblProductList.ProductID, subtblBlockList.BlockID,
tblProductList.SerialNumber, subtblBlockList.BlockSerial,
Max(subtblRunningHours.RHDate) AS MaxOfRHDate,
Max(subtblRunningHours.HoursAtDate) AS MaxOfHoursAtDate,
tblServiceReps.ServiceRepID, subtblRunningHours.ServiceReportID,
subtblRunningHours.IssueID
FROM tblServiceReps RIGHT JOIN ((tblSiteInformation RIGHT JOIN
(tblProductList RIGHT JOIN subtblBlockList ON tblProductList.ProductID =
subtblBlockList.ProductID) ON tblSiteInformation.SiteID =
tblProductList.SiteID) RIGHT JOIN subtblRunningHours ON
subtblBlockList.BlockID = subtblRunningHours.BlockID) ON
tblServiceReps.ServiceRepID = tblSiteInformation.ServiceRepID
GROUP BY tblProductList.ProductID, subtblBlockList.BlockID,
tblProductList.SerialNumber, subtblBlockList.BlockSerial,
tblServiceReps.ServiceRepID, subtblRunningHours.ServiceReportID,
subtblRunningHours.IssueID, tblProductList.DateDeleted
HAVING (((Max(subtblRunningHours.HoursAtDate)) Is Not Null) AND
((tblProductList.DateDeleted) Is Null))
ORDER BY Max(subtblRunningHours.HoursAtDate) DESC;
the question i have now, how do i take the MaxHoursAtDate and compare it to
the ranges in the first query? there is no key field that i can join the 2
queries on, so how to find what service interval might be required for the
product?
as always any and all help appreciated.
i have a query that builds a range of values to give me information on what
is kind of servicing is needed in those ranges. i built this based on the
information from this page: http://allenbrowne.com/ser-58.html
my code for that query looks like this:
SELECT RT.IntervalHours AS Minimum, (SELECT MIN(RT1.IntervalHours)
FROM tblRebuildIntervals AS RT1
WHERE RT1.IntervalHours > RT.IntervalHours) AS Maximum, RT.r1000hr,
RT.r5000hr, RT.r10000hr, RT.r15000hr, RT.r20000hr, RT.r25000hr
FROM tblRebuildIntervals AS RT;
the interval hours is the amount of time that the machine in question has
been running, the r1000hr and others are the service interval requirements
for the ranges.
now i have another query that finds the products running hours. that looks
like this:
SELECT tblProductList.ProductID, subtblBlockList.BlockID,
tblProductList.SerialNumber, subtblBlockList.BlockSerial,
Max(subtblRunningHours.RHDate) AS MaxOfRHDate,
Max(subtblRunningHours.HoursAtDate) AS MaxOfHoursAtDate,
tblServiceReps.ServiceRepID, subtblRunningHours.ServiceReportID,
subtblRunningHours.IssueID
FROM tblServiceReps RIGHT JOIN ((tblSiteInformation RIGHT JOIN
(tblProductList RIGHT JOIN subtblBlockList ON tblProductList.ProductID =
subtblBlockList.ProductID) ON tblSiteInformation.SiteID =
tblProductList.SiteID) RIGHT JOIN subtblRunningHours ON
subtblBlockList.BlockID = subtblRunningHours.BlockID) ON
tblServiceReps.ServiceRepID = tblSiteInformation.ServiceRepID
GROUP BY tblProductList.ProductID, subtblBlockList.BlockID,
tblProductList.SerialNumber, subtblBlockList.BlockSerial,
tblServiceReps.ServiceRepID, subtblRunningHours.ServiceReportID,
subtblRunningHours.IssueID, tblProductList.DateDeleted
HAVING (((Max(subtblRunningHours.HoursAtDate)) Is Not Null) AND
((tblProductList.DateDeleted) Is Null))
ORDER BY Max(subtblRunningHours.HoursAtDate) DESC;
the question i have now, how do i take the MaxHoursAtDate and compare it to
the ranges in the first query? there is no key field that i can join the 2
queries on, so how to find what service interval might be required for the
product?
as always any and all help appreciated.