UPDATE tableA, tableB
SET tableA.column2 = tableB.column2
WHERE tableA.rowID = tableB.rowID;


PB
  ----- Original Message -----
  From: John Mistler
  To: [EMAIL PROTECTED]
  Sent: Saturday, May 29, 2004 12:16 AM
  Subject: "Batch" Update?


  Let's say I have a table "A" with 25 columns.  I also have an identical
  table "B" with 25 columns (column names, indexes, everything the same).  I
  want to get the entry of column 2 of every row of table "B", and update
  column 2 of every row of table "A" WHERE the rowID from table "A" matches
  the rowID of table "B".  Is there a way to do this in one fell swoop,
rather
  than doing one at a time:

  UPDATE tableA SET column2 = 'column2EntryFromRowXOfTableB' WHERE T2RowID =
  T1RowID;

  With 10,000+ rows to update, even scripted in a repeat loop, this seems
  quite tedious.  In effect, I'm saying "Copy the column2 entry from one
table
  to column2 of another table, as long as their row IDs match."

  Any ideas on a "batch-type" update?

  Thanks,

  John


  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


Reply via email to