Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update from Sub-query
Message
 
 
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:
01519027
Vues:
34
>>Hi,
>>
>>I would like to create a SQL UPDATE that will update from a subquery. I have seen it here (on UT) but can't seem to find a message with an example. What I am trying to do is to have UPDATE that sets a value in a field based on the calculations done in another table in a sub-query. That is, I would have something like this:
>>
>>
>>UPDATE TableA Set Field1 = SUM_TOT  (select SUM( FLDA + FLDB) AS SUM_TOT FROM TableB group by 
>> TableB.FLDC)
>>
>>
>>I am sure that above is not correct. But what is the correct syntax?
>>
>>TIA.
>
>
>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
Thank you very much.
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform