Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using "OR"

Status
Not open for further replies.

tomk01

ISP
Oct 18, 2004
69
US
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
 
Like this ?
WHERE A.bcode=tempaccrreport.bcode AND
tempAccrReport.MOS 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"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top