Re: Complex SQL statement

2007-08-07 Thread peterhf
Worked perfectly! I looked at "$this->ModelName->query("the SQL string");" in the manual but didn't try it! Thanks both of you for you help. Peter - On Aug 6, 8:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thats a subquery - and while the newer mysql4.1 and above now supports > subque

Re: Complex SQL statement

2007-08-06 Thread Langdon Stevenson
Thanks for the correction :-) I didn't notice that there was a sub-query, just saw two queries. I will look harder next time. Regards, Langdon [EMAIL PROTECTED] wrote: > Thats a subquery - and while the newer mysql4.1 and above now supports > subqueries - cakephp uses a left inner join by de

Re: Complex SQL statement

2007-08-06 Thread [EMAIL PROTECTED]
Thats a subquery - and while the newer mysql4.1 and above now supports subqueries - cakephp uses a left inner join by default - if you want the speed and performance of the subquery youll have to use $this->ModelName->query("the SQL string"); otherwise read the manual/api on setting up query con

Re: Complex SQL statement

2007-08-06 Thread Langdon Stevenson
Hi Peter > I would appreciate someone pointing me to a reference which explains > how to code something like this in CakePHP: The "conditions" section of the manual (in the Models page from memory) covers the creation of complex conditions in queries. I don't see anything in your query that C

Complex SQL statement

2007-08-06 Thread peterhf
I would appreciate someone pointing me to a reference which explains how to code something like this in CakePHP: SELECT user_photos.name FROM user_photos WHERE user_photos.userID IN ( SELECT users.recordID