Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UPDATE SQL, How to use with correlated query.
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01011797
Message ID:
01011846
Views:
14
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform