Information générale
Catégorie:
Codage, syntaxe et commandes
>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 ??
Vinod
Your result is exactly what you would expect and want in most case where each of the three tables contains variable (unique) data relative to the parent.code. It sounds as though you expect 1 parent record with 2 merged records from child1 and child2. Since as you seem to indicate the data in the child records is duplicated, you must SQL the two child tables first and group them to one record per code. Then SQL this cursorof mreged child tables with the parent table.
(It begs the question, "If both child tables are twin children of a parent - maybe they should be one table instead of two)
Well anyway, grouping is the key, some way or another.
JP
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement