border
English Slovak
Main page | C# section | VB6 section | PHP section | MySQL section | Supremus.sk



How to select yesterday date in MySQL


How to select yesterday date in MySQL:

If we want to select yesterday's rows in table, that we must use condition with Yesterday date.

We can use SUBDATE() to get Yesterday date: SUBDATE(CURDATE(), 1)

Example in MySQL:

SELECT * FROM table_name
WHERE DATE(column_name) = SUBDATE(CURDATE(), 1);


Example for Yesterday date and Today date in MySQL:

SELECT SUBDATE(CURDATE(), 1 ) AS Yesterday, CURDATE() AS Today;


Result:
Yesterday Today
2013-04-30 2013-05-01




Comments

There are no comments for this article.

Add your comment, and be first.


Add your comment
User language:

Name:

Subject:





Human verification:
Number 193 is

separator

List of articles

Select yesterday date in MySQL
Select date range of current month
NOW(), CURDATE() and CURTIME() in MySQL

Smart utilities


Webdesign (c) 2009 - 2024 Supremus.sk
border