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.
SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 WEEK);
Thanks for read. I hope it help you. For more you can follow us on facebook.