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:
00552653
Vues:
16
>YES FINALLY!!! It worked!!! Exactly what I was looking for!!!
>
>-Thanks VERY MUCH!
>
>- Thanks to everyone else that tried to help too! I feel better that even though I've been a full time fox programmer since 1994 I don't feel so bad that I didn't know this right out.

Kevin,

I've just tried Sergey's SQL, and it doesn't include orphan divisions or companies without divisions. Here is an SQL, which includes them all (slight modification from my original idea):
select nvl(Companies.cKey,Division.cKey) as cKey, ;
       nvl(CompanyNam,padr('Orphan Divisions',30)) as CompanyNam, ;
       nvl(Div_Name,space(50)) as Div_Name from Companies ;
       full Join Division on Companies.cKey=Division.cKey into cursor curTemp1

select cKey, CompanyNam, min(Div_Name) as Div_Name from curTemp1 ;
group by 1 into cursor curTemp2

select * from curTemp2 ;
union all ;
select cKey, space(30) as CompanyNam, Div_Name from curTemp1;
where curTemp1.CompanyNam+curTemp1.Div_Name ;
      not in (select curTemp2.CompanyNam+curTemp2.Div_Name as keyfield from curTemp2) ;
order by 1 ;      
into cursor curFinal
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform