$this->Model->query('SELECT PersonIndentification.id,PersonIndentification.name
FROM (
         SELECT person_indentification_id, MAX(end_date) as edate
         FROM
      trainings group by person_indentification_id
   ) as x
RIGHT JOIN
person_indentifications AS PersonIndentification
ON
(x.person_indentification_id=PersonIndentification.id)
WHERE
x.person_indentification_id IS NULL
OR
x.edate<curdate()');


:-)

On Jul 18, 2011, at 9:15 AM, sanu manandhar wrote:

> Hi
> can anybody help me executing this query in cakephp
> 
> SELECT PersonIndentification.id,PersonIndentification.name
> FROM (
>          SELECT person_indentification_id, MAX(end_date) as edate
>          FROM
>       trainings group by person_indentification_id
>    ) as x
> RIGHT JOIN
> person_indentifications AS PersonIndentification
> ON
> (x.person_indentification_id=PersonIndentification.id)
> WHERE
> x.person_indentification_id IS NULL
> OR
> x.edate<curdate()
> 
> 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

Reply via email to