Hi Mark, could you post a code sample of how you solved?

I'm always interested in querying the db the cakephpway.

Thanks.

On Monday, August 27, 2012 10:30:55 PM UTC-4:30, Mark Wratten wrote:
>
> Figured it out for myself, the subquery just goes in place of the table 
> name.
>
> On Monday, August 27, 2012 6:17:05 PM UTC-4, Mark Wratten wrote:
>>
>> Is there a 'Cake' way of including subqueries in join clauses of SQL 
>> select statements?
>>
>> I'm looking to generate something in the form of -
>>
>> SELECT ... FROM table1
>> JOIN (SELECT DISTINCT key FROM table2 WHERE ...) table2 ON table2.key = 
>> table1.key
>>
>> I have been looking at joining tables in the docs, but it only seems to 
>> support joining tables rather than expressions. I could move the DISTINCT 
>> to the main query, but that does not perform as well, and also messes up 
>> pagination.
>>
>> Thanks
>>
>> Mark
>>
>

-- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to