:::: MENU ::::
Posts tagged with: timestamp

MySQL: Select today, yesterday or day before yesterday records

Usually when you work with records where a date or time-stamp field is present you need to select records from:

  • today records
  • yesterday records
  • day before yesterday records

Lets say you have a table (my_table) like this:

ID Name Date
1 Jon Dow 2011-01-10
2 Jane Dow 2011-01-10

where `Date` is date type fieldWatch movie online John Wick: Chapter 2 (2017)

Today records:

SELECT *
FROM `my_table`
WHERE `Date` = CURDATE()

Continue Reading