SELECT * FROM <table_name> WHERE <date_field> BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW();
Similarly, You can select records for 2 months, 3 months etc.
SELECT * FROM <table_name> WHERE <date_field> BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW();
0 comments:
Post a Comment