Re: Send Email to Customers Question
so you did this:
SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM customers c LEFT JOIN orders o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL;
in your myphpadmin and it returned nothing?
Re: Send Email to Customers Question
Quote:
Originally Posted by
philip937
so you did this:
SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM customers c LEFT JOIN orders o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL;
in your myphpadmin and it returned nothing?
That one returned data...
Re: Send Email to Customers Question
so somehow I need the customers_info table joined to this query and then add the time span the the WHERE clause.
Re: Send Email to Customers Question
I HAVE IT WORKING :)
this seems to do the trick:
Select
customers_info.customers_info_date_account_created,
customers.customers_lastname,
customers.customers_firstname,
customers.customers_email_address
From
customers_info Inner Join
customers On customers_info.customers_info_id = customers.customers_id
left Join
orders on orders.customers_id = customers.customers_id WHERE orders.date_purchased IS NULL AND
customers_info.customers_info_date_account_created BETWEEN (NOW() - INTERVAL 14 DAY) AND (NOW() - INTERVAL 7 DAY);
I thinnk you were getting no results on your previous suggesting is that you were selecting the order date. instead we are just narrowing results of the select where the is no order date.
I have noticed on the default query is has something like this:
select distinct c.customers_firstname as customers_firstname
the as bit, is this so it renames the column and therefore when the code to send email runs it picks customers_firstname ?