On Mon, Jul 12, 2010 at 6:40 PM, breakintheweb <jguagli...@gmail.com> wrote:
> I've been working on a subquery for several hours and can't figure it
> out in cakephp. I've tried mimicking the example in the book under
> complex find conditions and couldn't seem to make that work.
>
> Here is the query that when run manually in mysql works. The inner
> query is used to take out the duplicates for the count. Any help would
> be appreciated. Thanks in advanced
>
> SELECT COUNT(*) , zipcode, county, city
> FROM (
> SELECT zipcode, county, city
> FROM table
> WHERE zipcode IN ('34134', '34135', '33928', '34134', '34135')
> GROUP BY address, city, state
> ) AS table
> GROUP BY zipcode

The "complex find conditions" page is, unfortunately, missing a bunch
of stuff. Among them, finderquery. Actually, I can't seem to find
/any/ documentation on it right now. Try googling "cakephp
finderquery". Essentially, it allows you to write a custom query that
Cake will use.

But, in this case, I don't see why you need a subquery. It looks you
could simply pass the list of zipcodes as a condition.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to