Re: Database API blind spot

2007-01-23 Thread James Bennett
On 1/22/07, Tim Chase <[EMAIL PROTECTED]> wrote: > Or, alternatively, one could do something like > > SELECT c.* FROM camps c INNER JOIN application a ON c.id = a.camp_id > > which might also be another way to let the optimizer take a crack > at doing it well. Yeah, though AFAIK the 'extra' metho

Re: Database API blind spot

2007-01-22 Thread Tim Chase
> SELECT * FROM camps where id in (SELECT DISTINCT camp_id FROM application); Computing the DISTINCT portion here may be superfluous, and possibly (depending on your DB) a premature mis-optimization. Whether DISTINCT or not, membership via IN will still behave the same, but DISTINCT will requi

Re: Database API blind spot

2007-01-22 Thread James Bennett
On 1/22/07, Chris Brand <[EMAIL PROTECTED]> wrote: > I have an app with Applications, each of which is for a single Camp. > What I want to do is retrieve all the Camps for which there exists an > Application. The straightforward way is to retrieve a list of distinct values for 'camp_id' from the

Database API blind spot

2007-01-22 Thread Chris Brand
I have the feeling that this is something that should be straightforward, but I can't see how to do it. I have an app with Applications, each of which is for a single Camp. What I want to do is retrieve all the Camps for which there exists an Application. Thanks, Chris --~--~-~--~--