Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An Odd SQL Select Statement
Message
 
À
20/08/1997 13:41:59
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00045875
Message ID:
00046130
Vues:
37
>>I have a table with the following fields: label, address, city, state and zip. I want to find all records in which the address, city, state and zip are the same but label is different. The problem I am having is there are two record for each match. One in which consigne matches contemp and one in which contemp matches consigne. For example, I would have one record in which o_labela = 13 and o_labelb = 25 and another record in which o_labela = 25 and o_labelb = 13. How do I eliminate this duplication? The following is my current SQL statement (note: contemp is just a copy of consigne):
>>
>
>Add a group by...
>
>
>SELECT ;
>   consigne.o_label AS o_labela, ;
>   contemp.o_label AS o_labelb, ;
>   consigne.o_address1,;
>   consigne.o_address2, ;
>   consigne.o_city, ;
>   consigne.o_state, ;
>   consigne.o_zip ;
>FROM ;
>   consigne, contemp ;
>WHERE ;
>   consigne.o_label <> contemp.o_label AND ;
>   consigne.o_address1 = contemp.o_address1 AND ;
>   consigne.o_address2 = contemp.o_address2 AND ;
>   consigne.o_city = contemp.o_city AND;
>   consigne.o_state = contemp.o_state AND ;
>   consigne.o_zip = contemp.o_zip ;
>GROUP BY o_address1+o_address2+o_city+o_state+o_zip ;
>INTO TABLE ;
>   (lcDatapath+'condupe.dbf')
>
>
I tried this and got an error: "O_ADDRESS1 is not unique and must be qualified." Remember, I have two records for each address set.

Michael G. Emmons
memmons@nc.rr.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform