Thanks..that helped.
anil :)

-----Original Message-----
From: Roger Baklund [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 10:52 AM
To: [EMAIL PROTECTED]
Cc: Anil Garg
Subject: Re: date query.


* Anil Garg
> The date field in my database table looks as below:
> 07th of March 2003 10:14:29 PM

Then it is probably not a 'date field' in the sense that it is of type
"date", "datetime" or "timestamp".

> I need to write a query which gets me all the rows which are
> entered in last to weeks.
>
> Any ideas!!

Convert the existing column to a real date field, and use the powerfull
builtin date & time functions of mysql:

SELECT * FROM table WHERE datecol > NOW() - INTERVAL 14 DAY;

<URL: http://www.mysql.com/doc/en/Date_and_time_types.html >
<URL: http://www.mysql.com/doc/en/DATETIME.html >
<URL: http://www.mysql.com/doc/en/Date_and_time_functions.html >

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to