Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 07, 2012 10:11 AM by tusharrs
May 07, 2012 06:29 AM|LINK
select date_format(Fromdate,'%m/%d/%Y') as 'Fromdate' ,date_format(Todate,'%m/%d/%Y') as 'Todate'
where Fromdate >= '2012-05-01'
and Todate <= '2012-05-07';
I have a table consisting of Fromdate column and Todate column. Select query should retrive data between a certian range of date. Query works for Fromdate only but when i specify both Fromdate and Todate condition, its not retriveing any data even though
there is data in table in that range. am using mysql
May 07, 2012 06:35 AM|LINK
refer to this link
still problem exists then
post some sample data
May 07, 2012 06:48 AM|LINK
Between clause suggested by u works for one column to compare But I have two date columns in my table i.e FromDate column and Todate column.
May 07, 2012 06:58 AM|LINK
give some sample data for your dates
May 07, 2012 10:11 AM|LINK
select * from dates where
convert(varchar(10),fromdate,103) >= '01/01/2011' and
convert(varchar(10),todate,103) <= '20/12/2012'
here 103 format means dd/MM/yyyy
so use it for date columms and compare the date as string in the same format
fromdate is checked for >= to 1st jan 2011 and todate is checked for less than equal to 20th Dec 2012