Purchased in Previous 12 Months from Date of Purchase - SQL
You can accomplish this with a self join:

SELECT a.customer_id, a.product_id, a.purchase_date, MAX(b.purchase_date) IS NOT NULL AS previous_12_months
FROM products a
LEFT JOIN products b
  ON a.product_id = b.product_id AND
     a.customer_id = b.customer_id AND
     b.purchase_date &lt; a.purchase_date AND
     b.purchase_date &gt;= a.purchase_date - INTERVAL 12 MONTH
GROUP BY a.customer_id