On Tuesday February  27 2007 7:23 am, Kirill S. Palagin wrote:
> Hello.
>
> Our customer is trying to make statement
> SELECT * FROM Table1 WHERE SYSDATE - DateField > 30
> work and gets
> "Wrong data type in statement..."
>
> What would be correct statement to select rows with "DateField"
> older than 30 days from now?
>
> Thanks a lot.
> WBR,
> K. Palagin.

      There is a way to do this. It just takes a little reasoning to 
complete it.
     The customer wants to know what dates are more than 30 days prior 
to today. (I assume this has to do with invoice dates.) The first 
thing to do is to create a query with the dates and other information 
needed. To the right of the last Field entered, enter this formula:
DATEDIFF('dd', "Datefield",CURDATE())
When the query is run, all the information is listed in columns with 
the last column containing the difference between the Datefield" date 
and today's date. 
     But the customer only wants to see the information for this 
difference being greater than 30. So, now is the time to filter the 
results. Click the filter icon. Select 
DATEDIFF('dd', "Datefield",CURDATE()) as the field name. Select the 
condition as ">" (without the quotes). Enter 30 as the value. Click 
OK. The filter runs, and all the numbers in this last column are now 
greater than 30.
     Added note: once the customer is sure that this will work, click 
(tick) the Visible box in the DATEDIFF('dd', "Datefield",CURDATE()) 
column. The date differences between today of the Datefield dates 
will no long appear when the query is run.

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to