F.Hazi F.Hazi - 3 years ago 73
SQL Question

Compute SQL syntax - 3 tables from 3 different databases

I wanna get a syntax which add some informations into a table.
Syntax must collect informations from 2 tables and adding them into third table.
Let me explain interests:

Database account, table account: columns marked: id, login
Database player, table player: columns marked: account_id, name
Database common, table gmlist: columns marked: mAccount, mName


I wanna insert all items from column "name" (no empty columns) into gmlist based on id and account_id (condition to be the same).
*There are multiple names with same account_id, so isn't 1:1 rate.

Thank u developers !

Answer Source

Something like

insert into gmlist ( mAccount, mName )
select login, name from account.account a
inner join player.player p on p.account_id=a.id

might do the trick. I am still not certain about your columns.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download