Hi..All,

I am new to cakephp, If any one can help me how to write left joins in cake
php. please conver below query in cakephp

                $sql = "SELECT `c`.`campaign_id`, `c`.`supplier_id`,
`c`.`brand`, `c`.`start_date`, `c`.`end_date` FROM `campaigns` as `c`
                    LEFT JOIN `campaign_stores` as `cs` ON `c`.`campaign_id`
= `cs`.`campaign_id`
                    LEFT JOIN `stores` as `s` ON `cs`.`store_id` =
`s`.`store_id`
                    WHERE
                    ((c.start_date >= '{$this->startDate}' AND c.start_date
<= '{$this->endDate}')
                    OR (c.end_date >= '{$this->startDate}' AND c.end_date <=
'{$this->endDate}')
                    OR ('{$this->startDate}' >= c.start_date AND
'{$this->startDate}' <= c.end_date)
                    OR ('{$this->endDate}' >= c.start_date AND
'{$this->endDate}' <= c.end_date))
                    AND `c`.`status` != 'request'
                    AND `s`.`store_id` = '$storeId'";



Thanks in advance.....!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to