Yii Framework Forum: Sql Across Multiple Databases - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Sql Across Multiple Databases Rate Topic: -----

#1 User is offline   Gerhard Liebenberg 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 343
  • Joined: 07-January 12
  • Location:Stillbay - Western Cape - South Africa

Posted 20 November 2012 - 04:05 AM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users