SQL Help - update query with two tables

Bryan O'Neal BONeal at cornerstonehome.com
Fri May 23 19:03:13 MST 2008


BTW I am trying something like
UPDATE "A"  INNER JOIN "B" 
  ON "A"."ACCOUNT_ID" = "B"."ACCOUNT_ID"
SET "A"."CURRENT_BALANCE" = "A"."CURRENT_BALANCE"+ "B"."ACCOUNT_ID";
 
but it is not working

________________________________

From: plug-discuss-bounces at lists.plug.phoenix.az.us
[mailto:plug-discuss-bounces at lists.plug.phoenix.az.us] On Behalf Of
Bryan O'Neal
Sent: Friday, May 23, 2008 6:42 PM
To: Arizona State University Linux Users Group; Main PLUG discussion
list
Subject: SQL Help - update query with two tables


I have not done SQL by hand since sometime in 2005/2006 and I can not
remember how to do a dynamic update using more then one table.
 
Let us say I have a table A and a table B and I want to update a record
in table A for every record in table b base on information in table B.
For example, let us say I want A.CURRENT_BALANCE to be set to
A.CURRENT_BALANCE + B.DEPOSIT where A.ACCOUNT_ID = B.ACCOUNT_ID.
 
Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080523/41aa3808/attachment.htm 


More information about the PLUG-discuss mailing list