Im trying to create a table that will give me the max in a range. if the range is greater then the max I want it to use the highest number Here is my code: The Buld is where im using Or
SELECT A.accrualRate, (SELECT Min(B.MinimumService)
FROM caccrchart B
WHERE B.bcode = A.bcode AND
B.MinimumService>A.MinimumService) AS
MaximumService, tempAccrReport.id
FROM caccrchart AS A, tempAccrReport
WHERE (((A.bcode)=tempaccrreport.bcode) AND
((tempAccrReport.MOS) >= or Between A.MinimumService And
(SELECT Min(B.MinimumService)
FROM caccrchart B
WHERE B.bcode = A.bcode AND B.MinimumService>A.MinimumService)))
and A.accrualRate <> 0.00
and id = " 10001
SELECT A.accrualRate, (SELECT Min(B.MinimumService)
FROM caccrchart B
WHERE B.bcode = A.bcode AND
B.MinimumService>A.MinimumService) AS
MaximumService, tempAccrReport.id
FROM caccrchart AS A, tempAccrReport
WHERE (((A.bcode)=tempaccrreport.bcode) AND
((tempAccrReport.MOS) >= or Between A.MinimumService And
(SELECT Min(B.MinimumService)
FROM caccrchart B
WHERE B.bcode = A.bcode AND B.MinimumService>A.MinimumService)))
and A.accrualRate <> 0.00
and id = " 10001