left join - SQL merge tables with matching columns -


how can merge 2 tables same column names 1 table? this:

enter image description here

the 2nd table should fill in 1st table.

this close got

select *   animals left join best on animals.species=best.species; 

http://sqlfiddle.com/#!5/d0a98/3

but seems concatenate 2nd table on there.

is left join correct way this?

you should list columns in select. readily see need coalesce():

select a.price, a.species, coalesce(b.name, a.name) name animals left join      best b      on a.species = b.species; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -