How to fetch records for every day in a month using mysql -


i working mysql , having requirement reports registration data every day (if search month) in month , every month (if search based on year).

here query used result

query:

select    count(tenant_id) registered,    date_format(created_date,'%d') weeks  asign_user  date_format(created_date,'%m')='02'  , date_format(created_date,'%y') = '2014'  group date_format(created_date,'%d'); 
 ------------------------------- day       |     registered ------------------------------- 11                   5 12                   6 13                   1 14                   8 16                   9 25                   15 

expected result should

------------------------------- day       |     registered ------------------------------- 01                   0 02                   0 03                   0 04                   0 05                   0 06                   0 .                    . .                    . .                    . .                    . 11                   5 12                   6 13                   1 14                   8 15                   0 16                   9 .                    .   .                    . 25                   15 .                    .   .                    . 30/31                0 

i once created table called "all_days", consisted of days in given period( 5years ). use 1 outer-join , create output, desired. advise not use approach , on application level( thats strawberry said ). used approach in reporting engine, didnt allow application level coding, worked me.... result quite slow :(


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -