At 17:10 -0500 3/7/03, Christopher M Burger wrote:
Hello everyone,

I'm trying to write a query that would update a field in a table.  Here is
the catch.

Table 1 has two fields - field A and Field B
Table 2 has two fields - field A and Field B

Each table has many more fields but these are the only two I'm concerned
with right now.

Field B in table 2 is empty. Field B in table 1 is filled.  Field A is
filled in both tables.  What I would like to do is set field B in table 2 to
the value of field B in table 1 where field A in table 2 is equal to field A
in table 1.

Any help would be appreciated.

Chris Burger



UPDATE t1, t2 SET t2.B = t1.B WHERE t2.A = t1.A;


Requires MySQL 4.0.2.

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to