That will work for MySQL, just be aware that this is a SQL extension
that isn't supported by all databases. Using an EXISTS or a correlated
sub-query will work on other databases because it is ANSI SQL.

On Dec 24, 3:26 am, Nature Lover <[email protected]> wrote:
> Hi!
>
> Thanks for the help!
>
> I got it resolved using If in MySQL query as condition
>
> $condition = 'IF(((select count(*) from '.$Table.' where
> language_code="'.$this->Session->read('Site.Language').'" and '.
> $ReferKey.'='.$Model.'.'.$ReferKey.')>0), 
> language_code="'.$this->Session->read('Site.Language').'", 
> language_code=(select code from
>
> languages where base=1))';
>
> in
>
> $countrytranslations=$this->User->UserAddress->Country->CountryTranslation->find('list',array('conditions'=>array
>
> ($condition),'fields'=>array
> ('CountryTranslation.country_iso2','CountryTranslation.name'),'group'=>array
> ('CountryTranslation.country_iso2'),'order'=>array
> ('CountryTranslation.name')));
>
> Regards!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to