Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Help Needed Please!
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00548100
Message ID:
00548130
Views:
12
>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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform