Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Problem in 3 files
Message
De
23/07/1997 09:41:50
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
 
 
À
23/07/1997 09:29:18
Jp Steffen
Leadership Data Services
Des Moines, Iowa, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00041299
Message ID:
00041312
Vues:
65
>>>>>I have 3 files, 1 parent & 2 child
>>>>>
>>>>>When I give statment like :-
>>>>>
>>>>>sele parentfield, child1, child2 from parent, child1, child2 where parent.code=child1.code and parent.code=child2.code
>>>>>
>>>>>It shows me double records i.e.
>>>>>
>>>>>if a parent record is having 2 child records in each file, it is showing me 4 records, instead of 2. (values are getting repeated).
>>>>>
>>>>>Any Ideas/suggestions ??
>>>>
>>>>Try adding a "GROUP BY parent.code" clause to your SELECT statement.
>>>
>>>select distinct. otherwise you'll see first rec child1 and first rec child2, first rec child1 second rec child2, etc.
>>
>>It is showing me only one record.. Pls advs..(it should show 2)
>Vinod,
>
>Dave's suggestion to SELECT DISTINCT is the correct one (for NORMAL data) and actually better than my Group By with two SQLs, even though I think my solution should work. The problem is that if SELECT DISTINCT does not work for you, why do you want to SELECT 2 duplicate records, and how come that is more desirable that 4 duplicate records?
>
>SQL is fun! Right?
>JP

No, I don't want to select duplicate records, I will tell you exactly:-

Parent->Name -> 1 Rec
Child->contact -> 2 rec (contact nos. of name)
child->address -> 2 rec (2 address, off, res)

simply I want
Name from name, phone from contact, address from address
same way in the second record

name from name, 2nd phone from contact, 2nd address from address.

Now, Pls tell me the way..

SQL is not fun...Always I face problem in it...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform