MySQL 5.0.15 : strange behaviour with current_date

2005-12-07 Thread christophe nauwelaers
Hi,

For any reason, current_date doens't look to behave normally since a few
days.
I run reports in a MySQL DB through sql queries and I use a statement like 
... invd between current_date - 7 and current_date - 1 ... It always
worked.
I just noticed that this week's report was wrong. Indeed : current_date - 7
returns an empty set while current_date - 2 returns the correct date.
Current_date - 8 returns an empty set an a warning : Warning | 1292 |
Incorrect date value: '20051199' for column 'invd' at row 1
Current_date -100 returns the 30 last days, current_date - 200 returns the
60 last days.
Maybe I'm missing something very basic with the use of current_date, but I
really don't understand why current_date - 7 doesn't work anymore.
I must say that I upgraded my DB from 4.1 to 5.0 on the 21st of november,
but I don't remember having problems with my reports the days after.
Does anyone have an idea of the problem ?
Thanks in advance.

C.N.


Re: MySQL 5.0.15 : strange behaviour with current_date

2005-12-07 Thread Santino

In current_date - 7 the date is converted to a string and than to an Integer.
Use adddate function:
adddate(CURRENT_DATE(),interval -1 day)

Santino
At 11:37 +0100 7-12-2005, christophe nauwelaers wrote:

Hi,

For any reason, current_date doens't look to behave normally since a few
days.
I run reports in a MySQL DB through sql queries and I use a statement like 
... invd between current_date - 7 and current_date - 1 ... It always
worked.
I just noticed that this week's report was wrong. Indeed : current_date - 7
returns an empty set while current_date - 2 returns the correct date.
Current_date - 8 returns an empty set an a warning : Warning | 1292 |
Incorrect date value: '20051199' for column 'invd' at row 1
Current_date -100 returns the 30 last days, current_date - 200 returns the
60 last days.
Maybe I'm missing something very basic with the use of current_date, but I
really don't understand why current_date - 7 doesn't work anymore.
I must say that I upgraded my DB from 4.1 to 5.0 on the 21st of november,
but I don't remember having problems with my reports the days after.
Does anyone have an idea of the problem ?
Thanks in advance.

C.N.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]