Get total Profile by weeks with no of week from user regirstered

I’ve two tables one is “complete_bets” and another is “users”, in first table I’ve a column profit in which users can enter their profit and loss day by day, Here is table screenshot

http://prntscr.com/f4fmw7

user table has an column ‘user_registered’ in which we stored the date when user did registered.

I wants to get profit of any user by weeks, means profit with number of weeks as a member on website.

Right now I’m using this query

SELECT CONCAT(YEAR(`date_added`), '/', WEEK(`date_added`)) AS lol, WEEK(`date_added`) AS week_name, SUM(profit) as overallProfit FROM wpdw_complete_bets WHERE user_id = '1' GROUP BY week_name ORDER BY date_added ASC

But its getting me week of the year but I wants profit/loss weekwise with number of weeks as a member on website.

Please let know how can I write my query to get it working, any kind of help would be much appreciable.

Read more here: Get total Profile by weeks with no of week from user regirstered

Leave a Reply

Your email address will not be published. Required fields are marked *