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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -