Hi Majna,
Thanks for ur reply. but persistent connections in database.php
were set to false and the association is hasOne for my tables.
I am placing my code here ,
Tables : coupons (in AAA database), Retailers(in BBB database)
Coupon Model:
class Coupon extends AppModel
{
public $useTable = 'coupons';
public $useDbConfig = 'AAA';
public $primaryKey = 'coupon_id'; // id is the field name in the
database
public $hasOne=array(
// join coupons_map which is
in same database as coupons
'CouponsMap' => array(
'className' => 'CouponsMap',
'foreignKey' => false,
'conditions' =>
'Coupon.coupon_id=CouponsMap.coupon_id',
'type' => 'INNER'
),
// joins retailer table
which is in another database
'Retailer' => array(
'className' => 'Retailer',
'foreignKey' => false,
'conditions' =>
'Coupon.retid=Retailer.retid',
'type' => 'INNER'
)
);
}
Retailer Model:
class Retailer extends AppModel
{
public $useTable = 'retailers';
public $useDbConfig = 'BBB';
public $primaryKey = 'retid'; // id is the field name in the database
}
* $useDbConfig variables are set in database.php with their
respective details.
when execute this i m getting a query which is only bringing Retailer
columns without joining it with Coupon table.
I hope u got my problem.
Thanks,
Sreekanth
On Aug 27, 1:57 pm, majna <[EMAIL PROTECTED]> wrote:
> http://groups.google.com/group/cake-php/browse_thread/thread/d33b55ff...
> - Do not use persistent connections in database config
> - HABTM associations wont work here
>
> On Aug 27, 9:25 am, sree <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I am unable to join two tables of two different databases.I ll explain
> > in detail.
>
> > i have coupons table in AAA database n retailers tables in BBB
> > database .i have join these two tables.as following
>
> > AAA.coupon.coupon_id=BBB.retailer.coupon_id
>
> > i have created two models Coupon n Retailer with respective database
> > table n dbconfig details in them.
>
> > Please help me.
>
> > Thanks inadvance.
>
> > sreekanth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---