On Mon, 19 Aug 2002, Nick Fankhauser wrote:
>
> This may not be the best way, but I couldn't resist taking a shot at it...
Thanks for the response Nick. If only I knew I was going to get a
response from a block away, I would have just come down to say hi. :)
I had an "a ha" moment about this over lunch. I was making the problem
much harder than it needed to me, having assured myself I was going to
need some advanced SQL feature to solve the problem. Some testing seems to
reveal that I can address this problem simply by joining against the
park_feature_map table N times. This way I only need to match against 1
row each of these tables, which is easy in SQL. Here's my statement I
tested with for N=2:
SELECT p.park_id, park_name FROM parks p JOIN park_feature_map map_4 ON (p.park_id = map_4.park_id AND
map_4.feature_id=4) JOIN park_feature_map map_15 ON (p.park_id = map_15.park_id AND map_15.feature_id=15);
In this way, I'm only returned the parks that match all the features.
Thanks again for your help!
-mark
http://mark.stosberg.com/