Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UPDATE SQL, How to use with correlated 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
Database:
Visual FoxPro
Divers
Thread ID:
01011797
Message ID:
01011846
Vues:
15
You're welcome.

>Thanks to everyone, today I've learn something new!!
>
>Try
>
>
>UPDATE cAgent ;
>  SET yMonth = dtSum.yMonth ;
>  	FROM cAgent ;
>  	JOIN ;
>		(SELECT SUM(yAmount) AS yMonth, ;
>					iAgentID, MONTH(dDate) AS nMonth, ;
>					Year(dDate) AS nYear ;
>    			FROM cMovs ;
>				GROUP BY iAgentID, nMonth, nYear) dtSum ;
>			ON dtSum.iAgentID = cAgent.iID ;
>                    AND dtSum.nMonth = cAgent.nMonth ;
>                    AND dtSum.nYear  = cAgent.nYear
>
>>Lets supose I have a table with every entry in the system:
>>
>

--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform