dimanche 8 février 2015

No need of using date_sub() function in MySQL


I was trying to figure out the scenarios where I can procure 30 days back date using MySQL 5.5 SQL Queries and function. I saw that the following two statements are similar and wondering why do we need date_sub() function in MYSQL ?


SQL Query 1:



SELECT CURDATE()-INTERVAL 30 DAY AS 30_days_ago;


SQL Query 2:



SELECT date_sub(CURDATE(),INTERVAL 30 DAY);


Please explain





Aucun commentaire:

Enregistrer un commentaire