MySQL Interval

MySQL Cluster

MySQL interval values are used mainly for date and time calculations. INTERVAL {value of unit} {types of interval} INTERVAL is a MySQL keyword and this is case sensitive. This should be used in CAPITAL Later Only {value of unit} is a expression or value like 1,2,3,4 or any expression which result in value. {type of … Read more

mysql query get date of 1 month interval

MySQL Cluster

Very often we need to extract last 1 month, 2 months data from mysql DB. Here we will show easy way to get the data of given interval. SELECT * from testtable WHERE startdate BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND DATE_SUB(NOW(), INTERVAL 2 MONTH) The above query will return records whose order date is between one and … Read more