Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Inner Join Clause in the Model.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
padma  
View profile  
 More options Feb 26 2012, 7:15 pm
From: padma <padmakumar.peru...@gmail.com>
Date: Sun, 26 Feb 2012 16:15:18 -0800 (PST)
Local: Sun, Feb 26 2012 7:15 pm
Subject: Inner Join Clause in the Model.
Hi,

  I have the model configured with belongsto association.

  In this the query outputted looks like

  SELECT `Firstpage`.`firstpagesid`, `Firstpage`.`imgnum`,
`Firstpage`.`pageloc`, `Firstpage`.`desc_id`,
`actressdesctbl`.`actressnum`, `actressdesctbl`.`actressfname`,
`actressdesctbl`.`description`, `actressdesctbl`.`imgloc` FROM
`firstpages` AS `Firstpage` INNER JOIN `actressdesctbls` AS
`actressdesctbl` ON (`Firstpage`.`desc_id` = `actressdesctbl`.`id`)
WHERE `firstpage`.`pageloc` = 1 ORDER BY `firstpage`.`imgnum` asc

 The model association is listed below as well

class firstpage extends AppModel {

    public $name = 'firstpage';
    public $belongsTo = array(
        'actressdesctbl' => array(
            'className'    => 'actressdesctbl',
            'foreignKey'   => 'desc_id',
            'type'         => 'INNER'
        )
    );

}

 Here the inner join is between desc_id in the firstpages table and
the id in the actressdesctbl.  I dont want the inner join to default
to id in the actressdesctbls.  Instead i have another column in the
same table to which I need to join...Can I override the default...I
dont want to use any prepared statement.

Thanks for your help.

Thanks
padma Kumar


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jeremyharris  
View profile  
 More options Feb 27 2012, 11:01 am
From: jeremyharris <funeralm...@gmail.com>
Date: Mon, 27 Feb 2012 08:01:31 -0800 (PST)
Local: Mon, Feb 27 2012 11:01 am
Subject: Re: Inner Join Clause in the Model.

It sounds like you should probably just include your own 'join' 'key[1] in
your find statement then.

1: http://book.cakephp.org/1.3/en/view/1047/Joining-tables


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
padma  
View profile  
 More options Feb 27 2012, 9:22 pm
From: padma <padmakumar.peru...@gmail.com>
Date: Mon, 27 Feb 2012 18:22:21 -0800 (PST)
Local: Mon, Feb 27 2012 9:22 pm
Subject: Re: Inner Join Clause in the Model.
Thanks Jeremy...I changed the primary key in the Model Attribute and
works like a charm.

On Feb 27, 11:01 am, jeremyharris <funeralm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Harris  
View profile  
 More options Feb 27 2012, 9:28 pm
From: Jeremy Harris <jer...@42pixels.com>
Date: Mon, 27 Feb 2012 18:28:28 -0800
Local: Mon, Feb 27 2012 9:28 pm
Subject: Re: Inner Join Clause in the Model.

Yep that will do it. I wasn't sure you were free to change the primary key.
On Feb 27, 2012 6:22 PM, "padma" <padmakumar.peru...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »