Your select works fine within the month to the exception of the first day because curdate()-1 is treated as a numeric field (see curdate in http://www.mysql.com/doc/en/Date_and_time_functions.html)
The following seems to be what you want to do: mysql> select date_format(curdate()- interval 1 day,'%Y%m%d'); +-------------------------------------------------+ | date_format(curdate()- interval 1 day,'%Y%m%d') | +-------------------------------------------------+ | 20040229 | +-------------------------------------------------+ 1 row in set (0.00 sec) or, if you want the '-' mysql> select date_format(curdate()- interval 1 day,'%Y-%m-%d'); +---------------------------------------------------+ | date_format(curdate()- interval 1 day,'%Y-%m-%d') | +---------------------------------------------------+ | 2004-02-29 | +---------------------------------------------------+ 1 row in set (0.00 sec) Bernard On Monday 01 March 2004 05:15, Campanella Danilo wrote: > Hi, > > Look at what happened today : > > mysql> select curdate(); > +------------+ > > | curdate() | > > +------------+ > > | 2004-03-01 | > > +------------+ > 1 row in set (0.00 sec) > > mysql> select (curdate()-1); > +---------------+ > > | (curdate()-1) | > > +---------------+ > > | 20040300 | > > +---------------+ > 1 row in set (0.00 sec) > > mysql> > > Until yesterday > > select (curdate()-1); > > worked fine. > > I use MySQL version 4.0.12. Does anybody know something about? > > Ciao > > Danilo > > -------------------------------------------------------------------- > CONFIDENTIALITY NOTICE > This message and its attachments are addressed solely to the persons > above and may contain confidential information. If you have received > the message in error, be informed that any use of the content hereof > is prohibited. Please return it immediately to the sender and delete > the message. Should you have any questions, please contact us by > replying to [EMAIL PROTECTED] > Thank you > www.telecomitalia.it > -------------------------------------------------------------------- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]