Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update from Sub-query
Message
 
 
À
24/07/2011 17:36:10
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:
01519025
Vues:
75
This message has been marked as the solution to the initial question of the thread.
>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
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