Skip to content

All topics  /  MySQL

How To Get Last 7 Days Data In MySQL?

MySQL ·

Hi Friends,

I am going to explain you example of how to get last 7 days data in MySQL?. You will learn get last 7 days data MySQL. I would like to how to get last 7 days data SQL query.

This article will give you simple example of how to get last 7 days record in MySQL. We will use how to get last 7 days data from a table in MySQL.

We will use MySQL query to get 7 days data records.

Let's see bellow example:

Table : users


Solution SQL Query:

SELECT 
    * 
FROM `users` 
WHERE DATE(created_at) >= (DATE(NOW()) - INTERVAL 7 DAY)

Output:

I hope it will help you...