Get data from previous years dynamically
You can do that with a simple join and intervals. Assuming the table with your data is named mydata and the table you mention in your question with a list of dates named mydates, you could issue the following query:

SELECT d.id, d.fname, d.date_field, dat.*
FROM mydates d
JOIN mydata dat
    ON (dat.date_field &gt;= (d.date_field - interval 2 years) 
    AND dat.date_field &lt; d.date_field)
ORDER BY 3, 1;