SELECT cus.*
FROM customer cus
WHERE EXISTS (
SELECT * FROM orders ord
WHERE ord.customer_no = cus.customer_no
AND ord.region_no = cus.region_no)
>I have a customer table and an orders table. I want a cursor of all custmers who have had an order, with no duplicates on customer_no and region_no (together they make a unique key), and the output cursor needs to be in the same structure as the customer table. There are hundreds of fields in the customer table and I do not want to put an aggregate on each field, this is the problem. I know to join the customer table and the orders table on customer_no. But there could be duplicates returned and I want to GROUP BY customer_no, but I do not want to put an aggregate on each customer table field.
--sb--