php - Less equal than specific date query not working on equal date -
i have query:
select count(a.no_registrasi) jumlah, b.nama_negara, a.tanggal_reg tb_registrasi join tb_negara_tujuan b on a.id_negara = b.id_negara a.tanggal_reg >= '2016-02-01' , a.tanggal_reg <= '2016-03-01' group b.nama_negara
but when im change to:
select count(a.no_registrasi) jumlah, b.nama_negara, a.tanggal_reg tb_registrasi join tb_negara_tujuan b on a.id_negara = b.id_negara a.tanggal_reg >= '2016-02-01' , a.tanggal_reg <= '2016-02-29' //this 1 group b.nama_negara
it didnt show result, im trying select data between 2 different dates, when when there's data on date @ end of month, didnt show data. have 5 data registered date 2016-04-30, when im selecting data 2016-04-01 2016-04-30 didnt show result.
hope guys understand mean, in advance.
apply date
function columns
where date(a.tanggal_reg) >= '2016-02-01' , date(a.tanggal_reg) <= '2016-02-29'
or use between
where date(a.tanggal_reg) between '2016-02-01' , '2016-02-29'
so query be:
select count(a.no_registrasi) jumlah, b.nama_negara, a.tanggal_reg tb_registrasi join tb_negara_tujuan b on a.id_negara = b.id_negara date(a.tanggal_reg) >= '2016-02-01' , date(a.tanggal_reg) <= '2016-02-29' //this 1 group b.nama_negara
or between
select count(a.no_registrasi) jumlah, b.nama_negara, a.tanggal_reg tb_registrasi join tb_negara_tujuan b on a.id_negara = b.id_negara date(a.tanggal_reg) between '2016-02-01' , '2016-02-29' group b.nama_negara