Bobby Heid
bheid at sc.rr.com
Mon Sep 26 14:09:06 CDT 2011
Chester, Well, right off the bat, you have Max(dbo_WellTests.TestDate) <#9/1/2011# and the maximum date in your list is 9/1/2011. So max(9/1/2011) is not less than 9/1/2011. So you get no records. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Monday, September 26, 2011 3:01 PM To: Access Developers discussion and problem solving Subject: [AccessD] Query not returning any records When I run the following query I get the results listed below SELECT dbo_WellTests.Well_API_14, dbo_WellTests.Well_Name, dbo_WellTests.TestDate FROM dbo_WellTests GROUP BY dbo_WellTests.Well_API_14, dbo_WellTests.Well_Name, dbo_WellTests.TestDate HAVING (((dbo_WellTests.Well_Name)="109-2")); Well_API_14 Well_Name TestDate 42415034120000 109-2 6/7/2011 42415034120000 109-2 6/8/2011 42415034120000 109-2 8/7/2011 42415034120000 109-2 8/28/2011 42415034120000 109-2 9/1/2011 42415034120000 109-2 9/5/2011 However when I run the following query I get no records returned. The table dbo_Welltests is an SQL Server table if that matters. SELECT dbo_WellTests.Well_API_14, dbo_WellTests.Well_Name, Max(dbo_WellTests.TestDate) AS MaxOfTestDate FROM dbo_WellTests GROUP BY dbo_WellTests.Well_API_14, dbo_WellTests.Well_Name HAVING (((dbo_WellTests.Well_Name)="109-2") AND ((Max(dbo_WellTests.TestDate))<#9/1/2011#)); Thanks. Chester Kaup Engineering Technician Kinder Morgan CO2 Company, LLP Office (432) 688-3797 FAX (432) 688-3799 No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com