php - MYSQL : Between or equal -
why not working if both value same use equal operator. user need select date & to, if user select both same date of & 2017-08-13
should still display dates of 2017-08-13
, unfortunately not working.
select * master_data.speed_of_service ( trans_time >= '2017-08-13' , trans_time <= '2017-08-13')
it work if there interval between dates
if had guess, because trans_time
has time component. 1 easy fix extract date:
select ss.* master_data.speed_of_service ss date(trans_time) >= '2017-08-13' , date(trans_time) <= '2017-08-13';
a better solution add 1 day "to" date:
select ss.* master_data.speed_of_service ss trans_time >= '2017-08-13' , trans_time < '2017-08-13' + interval 1 day;
this better because still allows use of index.
Comments
Post a Comment