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 cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.