get data for this and last year mysql code example
Example: mysql last year
SELECT * FROM my_table
WHERE YEAR(my_date) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 YEAR));
SELECT * FROM my_table
WHERE YEAR(my_date) = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 YEAR));