RE: SQL Help - update query with two tables

2008-05-24 Thread Bryan O'Neal
. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Sinclair Sent: Friday, May 23, 2008 7:21 PM To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables Sorry, hit send before rewriting to match your query: UPDATE A Set (CURRENT_BALANCE

Re: SQL Help - update query with two tables

2008-05-24 Thread Joseph Sinclair
list Subject: Re: SQL Help - update query with two tables Sorry, hit send before rewriting to match your query: UPDATE A Set (CURRENT_BALANCE) = (SELECT A.CURRENT_BALANCE + B.DEPOSIT From B WHERE A.ACCOUNT_ID = B.ACCOUNT_ID) WHERE EXISTS (SELECT 1 From B WHERE A.ACCOUNT_ID = B.ACCOUNT_ID

Re: SQL Help - update query with two tables

2008-05-24 Thread Alex Dean
Bryan O'Neal wrote: 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

SQL Help - update query with two tables

2008-05-23 Thread Bryan O'Neal
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

RE: SQL Help - update query with two tables

2008-05-23 Thread Bryan O'Neal
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

Re: SQL Help - update query with two tables

2008-05-23 Thread Joseph Sinclair
What's the server (i.e. Oracle, MySQL, PostgreSQL, etc...) Bryan O'Neal wrote: 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

RE: SQL Help - update query with two tables

2008-05-23 Thread Bryan O'Neal
IBM DB2 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Sinclair Sent: Friday, May 23, 2008 7:09 PM To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables What's the server (i.e. Oracle, MySQL, PostgreSQL, etc

Re: SQL Help - update query with two tables

2008-05-23 Thread Joseph Sinclair
a cursor... Bryan O'Neal wrote: IBM DB2 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Sinclair Sent: Friday, May 23, 2008 7:09 PM To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables What's the server (i.e

RE: SQL Help - update query with two tables

2008-05-23 Thread Bryan O'Neal
To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables UPDATE TABLEA SET (b, c, d) = (SELECT b1, c1, d1 from TABLEB WHERE TABLEB.a1 = TABLEA.a and TABLEB.e1 40) WHERE EXISTS (SELECT 1 from TABLEB WHERE TABLEB.a1 = TABLEA.a and TABLEB.e1 40); Not pretty, but should work

Re: SQL Help - update query with two tables

2008-05-23 Thread Joseph Sinclair
: IBM DB2 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Sinclair Sent: Friday, May 23, 2008 7:09 PM To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables What's the server (i.e. Oracle, MySQL, PostgreSQL, etc

RE: SQL Help - update query with two tables

2008-05-23 Thread Bryan O'Neal
wrote: IBM DB2 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Sinclair Sent: Friday, May 23, 2008 7:09 PM To: Main PLUG discussion list Subject: Re: SQL Help - update query with two tables What's the server (i.e. Oracle, MySQL, PostgreSQL