Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update from Sub-query
Message
 
 
À
25/07/2011 08:41:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01519023
Message ID:
01519056
Vues:
20
>>>
>>>
>>>Update TableA Set Field1 = ST.Sum_TOT
>>>FROM TableA INNER JOIN (select sum(FldA+FldB) as Sum_Tot from TableB group b y FldC) ST
>>>ON TableA.FieldC = ST.FieldC
>>
>>A follow up question, if I may, please. The above SQL Update will update only those records in table TableA that have child records in TableB, correct? So if I wanted to update ALL records in TableA, would it be correct to change JOIN with LEFT JOIN then? And then to do NVL(ST.SUM_TOT,0) instead of just ST.SUM?
>
>That sounds right to me.
>
>Tamar

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform