[AccessD] Need Query Help

Gustav Brock Gustav at cactus.dk
Wed Oct 21 08:26:58 CDT 2009


Hi Chester

2. Don't include record with SDate <1/1/2005 if Chase_Start_Date < 1/1/2005
3. Do include record if SDate <1/1/2005 and SDate_2 is < 1/1/2005

are contradicting. What if Chase_Start_Date < 1/1/2005 and SDate_2 is < 1/1/2005?

/gustav


>>> Chester_Kaup at kindermorgan.com 21-10-2009 15:04 >>>
I have a table with 4 fields PID, SDate, Chase_Start_Date and SDate_2.
I need to extract records based on the following criteria.

1. Sdate < 1/1/2005
2. Don't include record with SDate <1/1/2005 if Chase_Start_Date < 1/1/2005
3. Do include record if SDate <1/1/2005 and SDate_2 is < 1/1/2005

The Chase_Start_Date and SDate_2 fields may be blank or just the Sdate_2 field if the Chase_Start_Date field has data.

I have been working on this for a while and thought I had it with the following SQL statement but no. Time for another set of eyes to look at it.

SELECT SDate, Chase_Start_Date, SDate_2
FROM Constants
WHERE (((SDate)<#1/1/2005#) 
AND ((Chase_Start_Date) Is Null)) 
OR (((SDate)<#1/1/2005#) AND ((SDate_2)<#1/1/2005#));

Thanks.

Chester Kaup
Engineering Technician
Kinder Morgan CO2 Company, LLP
Office (432) 688-3797
FAX (432) 688-3799






More information about the AccessD mailing list