I have two tables user_profile and tracked_search. The user_profile table has user details and tracked_search tracks search made by user.
Whenever a user makes a search this search entry goes in tracked_search table. If nothing is searched for a particular date nothing is added in tracked_search.
I need to develop a report where in I need to show data from last 6 months for every week for example
Date week_count user_count
2017-05-01 18 10
2017-05-08 19 50
.
.
2017-07-03 27 80
.
2017-10-2 40 20
.
.
2017-10-23 43 40
the data should be grouped by week and user_count is number of distinct user who made search for that week. even if there is no data for a particular week it should print the week date, week count and user count as 0
my tables as follows
User_profile
user_id user_name user_emailId user_passsword user_role creation_date
1 Mac mac@yahoo.com password123 USER 23/10/2017
2 Shane Shane@yahoo.com password123 USER 23/10/2017
Tracked_search
id created content search_term, user_id
014af54e 2017-10-15 18:36:49 ARTICLE latest 1
08f55f2d 2017-10-18 18:34:04 EVENT upcoming 1
1e74f026 2017-10-25 18:37:11 DISCUSSION newest 2
20075e4a 2017-10-22 18:35:41 ARTICLE latest 1
22cde973 2017-10-17 18:36:49 ARTICLE latest 2
2d1d3314 2017-10-16 18:36:49 ARTICLE latest 2