mySQL query syntax error

[email protected] (Ron Piggott)
Newsgroups php.db
Organization Acts Ministries Christian Evangelism
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.