Welcome Guest, Not a member yet? Register   Sign In
How get current month records in Mysql?

I have many records for all days.
Some days have no data example 2020-12-10 or others.
When I use the below query:
SELECT COUNT(*),DATE(date_register) FROM tbl_order WHERE MONTH(NOW()) = 1
The query return only rows that exist for that date
How do I can set 0 for dates that not have any records

@omid_student ,

Right off the top of my head......try this: SELECT Count(*), DATE(date_register) FROM tbl_order Order By date_register. For me to dive in a little more deeper I would need more information about the table. Maybe you could use something like ... http://sqlfiddle.com/

What about CI Model way of counting? The same result? Documentation

Theme © iAndrew 2016 - Forum software by © MyBB