I am working in Moodle and CodeIgnitor together in one project; a few of my tables are in moodle db and other tables are in another database.
Is it possible to implement JOIN queries with two Mysql Databases to fetch the data we require?
I am working in Moodle and CodeIgnitor together in one project; a few of my tables are in moodle db and other tables are in another database.
Is it possible to implement JOIN queries with two Mysql Databases to fetch the data we require?
YES
NO
Yes.
If DB are on the same server, you can use
select a.col from db1.table1 a, db2.table2 b where a.col = b.col
Obviously you would put your join condition in here.
Yes.
Instead of using the "default" (currently selected) database, you can explicitly specify the database name when you reference your tables and fields:
You can refer to a table within the default database as tbl_name, or as db_name.tbl_name to specify a database explicitly. You can refer to a column as col_name, tbl_name.col_name, or db_name.tbl_name.col_name
However, I don't recommend this. If data are related between tables then they are supposed to be in the same database. That's what would make sense!