mysql get date interval of 30 days

MySQL Cluster

Very often we need to extract last 30 days, 7 days data from mysql DB. Here we will show easy way to get the data of given interval. SELECT DATE_FORMAT(create_date, ‘%m/%d/%Y’) FROM mytable WHERE create_date BETWEEN CURDATE() – INTERVAL 30 DAY AND CURDATE() Also note that CURDATE() returns only the DATE portion of the date, so … Read more