I'm trying to create a SQL query to add to the Query Builder table and need some assistance. Been running in circles for awhile

I'm looking for a query very close to "Customer has placed <X orders and has not placed any orders in Y Amount of time".

The second part I've been attempting to utilize from the existing queries. Specifically:
Code:
select o.date_purchased, c.customers_email_address, c.customers_lastname, c.customers_firstname from TABLE_CUSTOMERS c, TABLE_ORDERS o WHERE c.customers_id = o.customers_id AND c.customers_newsletter = 1 GROUP BY c.customers_email_address HAVING max(o.date_purchased) <= subdate(now(),INTERVAL 3 MONTH) ORDER BY c.customers_lastname, c.customers_firstname ASC
It is the "<X Orders" part I can't get. My attempts to integrate the COUNT function have failed.

And if someone manages that, maybe the following add on: "Customer has placed <X orders and has ordered product X and has not placed any orders in Y Amount of time".