Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Question on getting unique records without aggregate
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01097648
Message ID:
01097655
Vues:
13
This message has been marked as the solution to the initial question of the thread.
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform