How to fetch this week records in MySql ?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this blog i will show you how to fetch this week record in mysql. If we need to get all the records of current week by using mysql query. For example we have one table “items” and also columns are id, title, description, created_at and update_at. Now we want to get all the records of this week. so we can fetch all fields value by using DATE_SUB and INTERVAL of mysql. So now in the following example we can see how to select data of current week.

Example

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

Read Also : Laravel and AngularJS CRUD with Search & Pagination Example

Thanks for read. I hope it help you. For more you can follow us on facebook.

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →