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