I'm using the code below to return results from a mySQL field called registered_at so that I can get users who have registered on the site in the past 7 days and it works fine:
andWhere('registered_at > UNIX_TIMESTAMP(NOW() - INTERVAL 7 DAY)')
My problem is that I also need to get the users who have registered on the website in the last 7 days. The logic is to display the registered users for the past 2 weeks so that next I can output the difference between these 2 weeks as a percentage, for example: 10% more users this week.
I tried something similar:
andWhere('registered_at > UNIX_TIMESTAMP((NOW() - INTERVAL 14 DAY) - (NOW() - INTERVAL 7 DAY))')
But without success.
you can use it: