user3522145
user3522145

Reputation: 101

Using where clause in copying column data from one table to another in mysql

I am using the SQL window in phpmyadmin and trying to get data from column wndef in table ismysql into column wndef in table k2sql2 and ensure that the data coming from ismysql is from rows that match syn_offset in k2sql2.

There are many more rows of data in ismysql, but I want the tables to match where column uoffseta in ismysql equals column syn_offset in table k2sql2.

Here is the syntax I'm trying:

INSERT INTO k2sql2 (wndef)
SELECT wndef
FROM ismysql
where ismysql.uoffset = k2sql2.syn_offset

Corrections to my syntax much appreciated.

Upvotes: 1

Views: 1086

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271071

It sounds like you want an update not an insert:

update k2sql2 join
       ismysql
       on ismysql.uoffset = k2sql2.syn_offset
    set k2sql2.wndef = ismysql.wndef;

Upvotes: 1

Related Questions