ItSolutionStuff.com

How to fetch this week records in MySql ?

By Hardik Savani September 6, 2020
PHP MySql

If you require to get all the records of current week using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this week. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current week.

Example

SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 WEEK);

Tags:
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

MySQL Query to Get Current Year Data Example

Read Now →

MySQL Calculate Age from Date of Birth Example

Read Now →

MySQL Query to Get Current Month Data Example

Read Now →