"Reynier Perez Mira" <[EMAIL PROTECTED]> wrote on 04/18/2005 10:44:39 AM:
> Hi list > > I need to make a Quero that select all fields in wich the date are > inferior in 10 days to actual date. Something like this: > > Actual date: 18-04-2005 > > Select all fields in which are bigger than: 08-04-2005. > > How can I do this? > > Regards > > > > > > Reynier Pérez Mira > > 3ero. Ing. Informática > > Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy. > > > First: remember that MySQL uses dates in ISO format (YYYY-MM-DD HH:NN:SS.mmm). The date 18-04-2005 is written as '2005-04-18' for MySQL. Second: Assuming you are on v3.23 or newer SELECT ... FROM ... WHERE yourdatefield >= CURDATE() - INTERVAL 10 day; will find all of the records from today to 10 days ago. ( http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html) Shawn Green Database Administrator Unimin Corporation - Spruce Pine