Hi guys,

My client wishes to see all customers that have made more than 1 order
from their website. What I have is the following...

----------------------------------------------
SELECT orders.*, payment_authority.*
FROM orders LEFT OUTER JOIN payment_authority 
ON orders.order_id = payment_authority.order_id
WHERE orders.order_id IN 
(
        SELECT O.order_id FROM orders AS O 
        WHERE Exists (
                SELECT customer_id 
                FROM orders 
                WHERE orders.customer_id = O.customer_id 
                GROUP BY orders.customer_id
                HAVING COUNT(orders.customer_id) > 1
        )
)
AND orders.order_receipt_sent = 1
ORDER BY orders.customer_id

----------------------------------------------

Seems to work fine, pulls all multiple orders out - however there are
about 5 customers which come out that only appear once in the orders
database?

Can anyone see anything I may not be doing correctly with this query?

mike



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249687
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to