Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Help Needed Please!
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00548100
Message ID:
00548130
Vues:
13
>I know I've done this before but I just can't remember how...
>
>I have two tables that I want to create one cursor from. The two tables are 1 to many. In the resulting cursor I only want to show the one values ONCE, not however many records are in the child table. (this is for reporting purposes). How can I do this in a SQL statement?
>
>Any help from the SQL gurus out there would be greatly appreciated!

If it's summary report than something like that
SELECT Parenttable.*, ;
    SUM(Childtable.field1), SUM(Childtable.field2), ... ;
  FROM Parenttable JOIN Childtable ON Parenttable.PK = Childtable.FK ;
  GROUP BY Parenttable.PK ;
  INTO CURSOR ReportCursor
If you want to include child detail records
SELECT * ;
  FROM Parenttable JOIN Childtable ON Parenttable.PK = Childtable.FK ;
  INTO CURSOR ReportCursor
In the report you put parent info in the group header/footer and child info into detail band.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform