Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An Odd SQL Select Statement
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00045875
Message ID:
00046129
Vues:
36
>select ;
> consigne.PrimeryKey, ;
> 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 1 ;
>into table ;
> (lcDatapath+'condupe.dbf')
>
>By adding the PK from the table and grouping on it you will eliminate any dups of a record from the result.

This won't work because there won't be more than one record per primarykey in the result set. To give another example. Let's assume the table consigne has only the following two records:

Record 1 has: Record 2 has:
PK = FL100 PK = FL345
LABEL = 69A LABEL = 21F
ADDRESS1 = 1010 Wash Ave ADDRESS1 = 1010 Wash Ave
ADDRESS2 = Suite 200 ADDRESS2 = Suite 200
CITY = Miami CITY = Miami
STATE = FL STATE = FL
ZIP = 33186 ZIP = 33186

My SQL result set will be TWO records. In one record LABELA = 69A, LABELB = 21F, in the other record LABELA=21F, LABELB=69A. So, the problem is I only need ONE of these records not both. I think I'm too close to the problem because I'm completly baffled :).

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