Filtering results by Date Fields 
Author Message
 Filtering results by Date Fields

Hello,

I have never really used FoxPro or Visual FoxPro, but I
need to run a query that would bring results if a
particular date field had values less than 1901-01/01. The
data type of the field is Date and following is my query:

SELECT Fdfil1.fdctyrtdte, Fdfil1.fdcopyrtn,
Fdfil1.fdorigrtn,;
  Fdfil1.fdverfrtn, Fdfil1.fdctyrtdt2;
 FROM fdfil1;
 WHERE Fdfil1.fdctyrtdte < 1901-01-01

It gives errors, however, every time I try to run it. The
error is "Operator/Operand type mismatch."

What is wrong or what am doing wrong. How do I filter
result based on the above date value? This might be very
simple, but I have never used FoxPro so I guess I must be
missing something, but don't know what or how to correct
it.

Thanks Much!



Tue, 01 Nov 2005 06:34:20 GMT  
 Filtering results by Date Fields
Hello, JN!
You wrote  on Thu, 15 May 2003 15:34:20 -0700:

 J> I have never really used FoxPro or Visual FoxPro, but I
 J> need to run a query that would bring results if a
 J> particular date field had values less than 1901-01/01. The
 J> data type of the field is Date and following is my query:

 J> SELECT Fdfil1.fdctyrtdte, Fdfil1.fdcopyrtn,
 J> Fdfil1.fdorigrtn,;
 J>   Fdfil1.fdverfrtn, Fdfil1.fdctyrtdt2;
 J>  FROM fdfil1;
 J>  WHERE Fdfil1.fdctyrtdte < 1901-01-01

Try one of the following:

WHERE Fdfil1.fdctyrtdte < {01-01-1901}
or
WHERE Fdfil1.fdctyrtdte < DATE(1901, 1, 1)
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Tue, 01 Nov 2005 12:41:30 GMT  
 Filtering results by Date Fields
You may want to try using the DATE function, DATE(nYear, nMonth, nDay) i.e.
    ... WHERE Fdfil1.fdctyrtdte < Date(1901, 1, 1)

Hope this helps.
SG KHOO



Tue, 01 Nov 2005 23:02:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. results: Filtering no-match record/field (SELECT-SQL)

2. FP 2.5 erratic Select SQL results when using date fields

3. Question: Filtering the Date part out of a DATETIME field

4. Dataenvironment Filter property and filtering dates

5. date based results

6. Date Variable Question: Less 30 days result?

7. Date filter trouble

8. Filtering by date in Oracle Remote View

9. Filters and Dates

10. Entering date filter at runtime

11. Help: Strict Date and save/restore filters

12. Problem for converting DateTime field to Date Field

 

 
Powered by phpBB® Forum Software