sql - mysql date range ignores end date in result -


i not getting result till '2013-07-31' instead 1 day before enddate. how can add 1 day in '2013-07-31'

select * employee  admissiondate>='2013-01-01'  , admissiondate<='2013-07-31' 

2013-07-31 12:00:00 neither smaller nor equal 2013-07-31.

to fix either strip off time part datetime column using date()

select * employee  date(admissiondate) between '2013-01-01' , '2013-07-31' 

but won't make use of indexes. or add time part this

select * employee  admissiondate >= '2013-01-01'  , admissiondate <= '2013-07-31 23:59:59' 

sqlfiddle demo


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -