Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select problem with 3 Tables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01084546
Message ID:
01084549
Vues:
9
This message has been marked as the solution to the initial question of the thread.
Maybe you have duplicate 'prodno' in the product table for that duplicated row?

>I am having a problem with an SQL Select joining 3 tables.
>First I tried it out using only 2 tables:
>
>
> SELECT Customers.orderid, Customers.datesold, Customers.firstname,;
>  Customers.lastname, OrderDTL.prodno, OrderDTL.quantity, OrderDTL.saleprice;
> FROM ;
>     MYDBC!OrderDTL ;
>    INNER JOIN MYDBC!CUSTOMERS ;
>   ON  OrderDTL.orderid = Customers.orderid;
> WHERE  Customers.datesold = ( ?ddate );
> ORDER BY Customers.lastname, Customers.firstname
>
>
>This code obtains the correct number of records for each date I enter for DDATE
>
>Now I add the one field I need from the third table to this Select: products.prodname
>
>
>SELECT Customers.orderid, Customers.datesold, Customers.firstname,;
>  Customers.lastname, OrderDTL.prodno, OrderDTL.quantity, OrderDTL.saleprice, products.prodname;
> FROM ;
>     MYDBC!OrderDTL ;
>    INNER JOIN MYDBC!CUSTOMERS ;
>   ON  OrderDTL.orderid = Customers.orderid;
>   INNER JOIN MYDBC!PRODUCTS ;
>   ON OrderDTL.prodno = Products.prodno;
> WHERE  Customers.datesold = ( ?ddate );
> ORDER BY Customers.lastname, Customers.firstname
>
>
>But the results are that I get one duplicated record for each date I try. Only 1 record appears twice while all the other records appear only once.
>
>Is this a VFP/SQL quirk or what am doing wrong?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform