Stuart McLachlan
stuart at lexacorp.com.pg
Thu Dec 20 14:37:51 CST 2012
Try putting brckets around your OR clauses: WHERE (((dbo_DSS_WellTests.PID)=[T2].[PID]) AND ((dbo_DSS_WellTests.Testdate)=[MaxofTestDate]) AND ( ((dbo_DSS_WellTests.Test_Oil)>0)) OR (((dbo_DSS_WellTests.Test_HCGas)>0)) OR (((dbo_DSS_WellTests.Test_Wtrp)>0)) ) ORDER BY dbo_DSS_WellTests.Well_Name; Currently your indivuals ORs are "overriding":the previous AND conditions so you are getting a huge number of records. -- Stuart On 20 Dec 2012 at 14:58, Kaup, Chester wrote: > I have the following query that works fine. I need to return only > records where Test_Oil >0 or Test_HCGas>0 or Test_Wtrp >0. When I add > these criteria to the query it runs and runs but never completes. Is > there a better way to do this? 2 queries maybe? >