mySQL query syntax error
| From: | Ron Piggott | Date: | Sat, 14 Nov 2009 08:23:47 +0000 |
| Subject: | mySQL query syntax error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-46655@lists.php.net to get a copy of this message | ||
I am getting the following error message:
#1054 - Unknown column 'customers.email' in 'order clause'
from the query below --- I don't understand why. Would someone help me
please? Ron
SELECT 'first_name', 'last_name', 'email'
FROM (
(
SELECT
firstname , lastname , buyer_email
FROM paypal_payment_info
WHERE datecreation = '$two_weeks_ago'
GROUP BY buyer_email
)
UNION ALL (
SELECT mail_order_address.first_name ,
mail_order_address.last_name ,
mail_order_address.email
FROM mail_order_address
INNER JOIN mail_order_payment ON mail_order_address.reference
=
mail_order_payment.mail_order_address_reference
WHERE mail_order_payment.payment_received = '$two_weeks_ago'
GROUP BY mail_order_address.email
)
) AS customers
ORDER BY customers.email ASC