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:
00548222
Vues:
11
>Hmm. Got a syntax error on the first line.
>
>Here's my table layout as an example:
>
>Table 1: COMPANY
>companynam C,30
>ckey N,7
>
>Table 2: DIVISION
>div_name C,50
>ckey N,7
>
>Say table COMPANY has only 1 record and table DIVISION has 3 records. How can I create a cursor using SQL only to create 3 records with the field companynam being filled for the first record and not for the other two?
>
>Thanks!

Have you tried the idea I posted with your field names?
E.g.
select CompanyNam, Div_Name from Company left Join Division on Company.cKey=Division.cKey into cursor curTemp1

select * from curTemp1 group by 1 into cursor curTemp2

select * from curTemp2 ;
union ;
select 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,2 ; 
into cursor curFinal
I haven't tested it, but it looks right.
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