David McAfee
davidmcafee at gmail.com
Mon Sep 26 14:10:29 CDT 2011
Does this work? HAVING ((dbo_WellTests.Well_Name="109-2") AND (dbo_WellTests.TestDate<#9/1/2011#)); On Mon, Sep 26, 2011 at 12:01 PM, Kaup, Chester < Chester_Kaup at kindermorgan.com> wrote: > 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 >