MySQL inner join to update an existing table -


i have table called empty follows has paperkey value , else empty.

author | year | conference | paperkey                                1234 

and have table called base follows:

author | year | conference | paperkey andrew   1999     kdd           1234 

i want insert value retrieved in table base table empty.

i tried query follows did not work. how can modify query right result?

insert empty (author, year, conference) select t1.author, t1.year, t1.conference base t1 inner join empty t2 on t1.paperkey=t2.paperkey; 

you want update existing records, not insert new ones.

update empty t2 join base t1 on t1.paperkey = t2.paperkey set t2.author = t1.author,     t2.year = t1.year,     t2.conference = t1.conference 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -