> I'm trying to update existing records in one table so that value of a
> column winds up matching the value of a column in a second table, based on
> a match in a second column in each table.
> I'm not sure if I'm taking the wrong approach on this, of if I'm missing
> something simple in the SQL syntax (like this being illegal), but I'd
> appreciate any feedback on why MySQL is returning the "Unknown table"
> when the table does indeed exist (see output below). I can do this
> manually (v. small number of records involved) but for cases where doing
> by hand would be impractical, it would be helpful to be able to do this
> without writing a script.
> mysql> UPDATE dp_populate_vals
> -> SET dp_populate_vals.tbl_id=dp_populate_tables.tbl_id
> -> WHERE dp_populate_tables.tgt_tbl=dp_populate_vals.tgt_tbl;
update dg_populate_vals v
set v.tbl_id = (select t.tbl_id
from dp_populate_tables t where t.tgt_tlb = v.tgt_table)
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL