Re: How to do Update query using sum from another table
Posted by:
Rick James
Date: October 12, 2009 12:30AM
UPDATE mam_accounts a
JOIN
( SELECT PortIDNum,
SUM(m.NetFlows) as NetFlows
FROM cp_m
WHERE EndDate BETWEEN ... AND ...
GROUP BY PortIDNum
) m ON m.PortIDNum = a.PortIDNum
SET a.Last12MoNetFlows = m.NetFlows,
a.Last12MoDateStart = ...,
a.Last12MoDateEnd = ...
http://dev.mysql.com/doc/refman/5.0/en/update.html
Subject
Written By
Posted
Re: How to do Update query using sum from another table
October 12, 2009 12:30AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.