MySQL Forums
Forum List  »  General

date comparison
Posted by: venkat.gnp
Date: January 22, 2007 01:31PM

Hi,

I have a pretty simple query to fetch some details from a table in a give date range.

select *
from tab1
where date_format(tab1.col1,'%c/%e/%Y') >= '12/25/2006'
and date_format(tab1.col1,'%c/%e/%Y') <= '12/31/2006';

The above query works but when I change the date parameter to another year it does not work. i.e. the following query does not return any results.

select *
from tab1
where date_format(tab1.col1,'%c/%e/%Y') >= '12/25/2006'
and date_format(tab1.col1,'%c/%e/%Y') <= '01/21/2007';

It would be great if someone can let me know what am I doing wrong here.


Thank you,
Venkat

Options: ReplyQuote


Subject
Written By
Posted
date comparison
January 22, 2007 01:31PM
January 22, 2007 01:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.