Kaup, Chester
Chester_Kaup at kindermorgan.com
Thu Jan 3 09:35:47 CST 2013
Thanks for the suggestions and explanation. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Thursday, December 20, 2012 2:38 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Criteria Help in Query 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? > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com