There's a pretty good example of a join
here<http://bakery.cakephp.org/articles/nate/2009/01/21/quick-tip-doing-ad-hoc-joins-in-model-find>
.
Essentially you want to do something like
$records = $this->offerpromo->find('all', array(
'conditions' => array('Offerpromo.end_date <' . date()),
'joins' => array(
array( 'table'=>'db_offer',
'alias' => 'Offer',
'conditions'=>''Offer.offer_id = Offerpromo.offer_id))
);
On Wed, Mar 28, 2012 at 4:12 AM, LITTO CHACKO <[email protected]> wrote:
> Hello, i have a doubt regarding join in cakephp. i have a primary key
> which is a foreign key of other table... i want to retrieve the table
> along with values s in othertable by checking some condition sin two
> tables.....
> fields in first table:- db_offer
> offer_id seller_id package_id category_id
> reference_no title
> description extra_details offer_price original_price
> offer_weblink
> published offer_coverimage start_date end_date
> gallery_type flash_file
> width height embed_code notes hot_deals cleranace_deals
> today_special
> views
>
> other table:-db_offerpromotion
> id offer_id offer_type start_date end_date
> added_date published
>
> i want to retrive all values of offer with offerid from two tables
> with condition that todays date less than end datyes of offerpromo..
> can u please help..me..it's urgent?? how i can do this???
>
> when iam using hasmany... it retreives table but it is not performing
> check condition..pls help??
>
> --
> 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