Sql Across Multiple Databases

Hi guys

I use 2 databases and the getDbConnection() and tableName() functions in my models were changed to include each model’s own database in its connection. This results in AR working fine.

At one place, I’m retrieving data from 5 tables across both databases using Relational Query with several nested “with=>(array(…” statements. This works, but it returns masses of unwanted data.

So, I want to do the same using sql, but I can only find sql examples using 1 database component/connection. Can someone please help with an example of an sql statement where you can use more than one connection; or prefix the table with the database to use.

Ps. I guess the sql will have to use the "ON" statement for a relation between tables in different databases.

Many thanx