Nick Dale Nick Dale - 1 year ago 77
MySQL Question

mySql less than or equal to not accurate

I am trying to search using 2 dates. If the user chooses the same date for both from and to dates I get no results.

This example only gives me results from 2016-10-18 to 2016-10-19:

where ( >= '2016-10-18' AND <='2016-10-20')

How do I get it to include the second value?
Also if I have

where ( >= '2016-10-18' AND <='2016-10-18')

I get no results at all

I have had similar problems in the past with numerical value ranges

Any help greatly appreciated

Answer Source

try adding Hour and minute .. the date is form 00:00 and not for 23:59

 where ( >= '2016-10-18 00:00 ' AND <='2016-10-18 23:59') 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download