php - Between operator not working in mysql -
in mysql how sum between 2 dates. in query i'm getting days between same months(01-01-2016 31-01-2016) i'm not getting 2 different months (01-01-2016 06-02-2016) result returns null value.
select sum(cash),sum(advnce) tablename date between '$strt_dte' , '$srch_prev_date' group date
give following go. make sure dates formatted correctly!
$strt_dte = '2016-01-01'; $srch_prev_date = '2016-01-31'; $sql = " select sum(cash), sum(advnce) tablename date between '{$strt_dte}' , '{$srch_prev_date}' group date ";
Comments
Post a Comment