Phalcon join multiple database in single query

Usually in SQL or Codeigniter's Active record we can join 2 different database tables in single query like:

  • join database1.table1 on ..
  • join database2.table2 on ..

How do we achieve this is "Phalcon"?

I tried to do it, but got an error:

  • SQLSTATE[42S02]: Base table or view not found:
  • 1146 Table 'database2.table2' doesn't exist


1.8k

Hai; There is no problem at join tables in same database.

But my query is how do we JOIN tables in 2 different database? If i try to do it i get above error.

Please suggest some idea..

We have a client who has 2 databases. One is readonly and controlled by seperate software. The 2nd was created so we could add modules to the application with our own tables. Our tables need to join with the readonly tables from the first database. This is easy to do with raw sql:

SELECT ...
FROM db1.employee
LEFT JOIN db2.user ON(db1.employee.empid = db2.user.empid)

But how can this be acomplishd with phalcon modle relationships ?