I am aware that there are multiple posts about this, but I was not able to make it work for my code.
As the title suggests I want to join two tables from two different DBs together.
Here is my code:
$dbh1 = mysql_connect("$host", "$username", "$password")or die("cannot connect");
$dbh2 = mysql_connect("$host2", "$username2", "$password2", true)or die("cannot connect");
mysql_select_db("$db_name", $dbh1)or die("cannot select DB");
mysql_select_db("$db_name2", $dbh2)or die("cannot select DB");
//first table
//$sql = mysql_query("SELECT InterestedEntityId, Score FROM users.`user_interests` WHERE UserId= //$userID ORDER BY Score DESC", $dbh1);
//second table
//$sql = mysql_query("SELECT entities.`Name` FROM tags.`entities` WHERE Id = InterestedEntityId", $dbh2);
I want to get the 3 fields mentioned in select statements in one go (I.E. InterestedEntityId, Score, entities.Name
)
Any idea on how to join these two tables in one sql query. I tried using inner joins and adding the tablename (as this thread suggested), but the query did not return anything.
Any ideas please?