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:
00548200
Vues:
12
>That would still give me multiple parent records in REPORTCURSOR though. Forget about the report. All I want to do is create a cursor from two tables that have a one to many relationship where the one table only shows in the FIRST record REGARDLESS of how many records are created by the child table.
>
>So instead of:
>
>---COMPANY-------DIVISION----
>Company Name     Division Name 1
>Company Name     Division Name 2
>Company Name     Division Name 3
>
>I want a cursor that looks like this:
>---COMPANY-------DIVISION----
>Company Name     Division Name 1
>------------     Division Name 2
>------------     Division Name 3
>
>Thanks!

In your report (I assume, you use native VFP report), go to Report menu, Group, and make a group by CompanyName. Put all info about company in the group header.

If you really and badly need to create cursor with only first item filled, it could be done in few selects and update, but the main cursor should be updatable. Let me know, if you need more info on this idea.
select CompanyName, DivisionName from Companies left join Divisions into cursor curTemp1

select * from curTemp1 group by CompanyName into cursor curTemp2

select * from curTemp2 ;
union ;
select space(30) as CompanyName, curTemp1.DivisionName ;
from curTemp1, curTemp2 where curTemp1.DivisionName<>curTemp2.DivisionName ;
order by 1,2 && Unfortunately, empty record will go first, if you don't want it, you have to use third column SortOrder ;
into cursor curFinal
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform