Yeah the only thing I found is an article here http://www.foldifoldi.com/?p=436
I need the full database table name SELECT * FROM database_name.table like the example but that example from the link does not work with my setup with subqueries and manual joins I make myself. In the SQL print out the actual database name and error for Table not found when they cross over. SELECT * FROM `table` as TABLE never `default`.`table`. I did see the various database SQL statements as you described but still for now it can just be a something to look into later. For standard queries everything worked fine, but deeper more complex "contained" finds was a nightmare. So for now all in 1 database will have to do for now. Maybe create a ticket so Cake gives option of using full database name plus table and not just the short model table name? Never did that before. Is a ticket for a problem only? Feature suggestion? Thanks all the same. K -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of ShadowCross Sent: Saturday, February 12, 2011 2:22 AM To: CakePHP Subject: Re: Joins across tables? It works for me: class Country extends AppModel { var $useDbConfig = 'iso'; } class Address extends AppModel { var $useDbConfig = 'default'; var $belongsTo = array( 'Country' => array( 'className' => 'Country' ) ); } Whenever I access the Address table, CakePHP sends two separate SQL queries. The first query retrieves all the addresses matching the conditions, the second query retrieves all the countries for those addresses. It then assembles the results into the array. But so far I've only used the $belongsTo, and I'm using Cake's "automagic". Check if you are using a custom query. On Feb 11, 7:00 pm, "Krissy Masters" <[email protected]> wrote: > Just curious if joins across database tables are supposed to work? Same > server just different databases. > > Set up my > > public $useDbConfig = 'dataDb'; > public $useDbConfig = 'optiDb'; (in each model depending on its db > obviously) but now queries come across > > SQL Error: 1146: Table 'dev_lab.categories' doesn't exist > > If I go to category page its there no errors because that page has no joins > across db's. But a controller / page where categories has joins with a model > in another db I get the missing error. > > Any insight? > > Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
