JimmyCrackedCorn
Posts: 583
|
| Posted: 09/16/2008, 4:11 PM |
|
I'm implementing a many-to-many relationship using a junction table (tblParks<----->>>tblParks_Amenities<<<----->tblAmenities) and trying to let users search using a multiple selection listbox.
It is working but when users choose multiple items in the listbox the query matches all records in tblParks that contain any of the selections rather than those records that contain all of the selections.
for example, if they select "basketball courts" and "parking" for amenities the the query returns every park that has basketball and every park that has parking. but what I want it to return is only those parks that have both basketball and parking.
here is my query...
SELECT DISTINCT tblParks.Park_Id, tblParks.Title FROM tblParks LEFT JOIN tblParks_Amenities ON tblParks.Park_Id = tblParks_Amenities.Park_Id WHERE (tblParks_Amenities.Amenity_Id IN ({s_Amenities}))
I know the IN statement tests for set membership but I'm wondering if there is any way to convert this to completely match the set rather than test for membership?
<this is related to my post entitled "Seeking Ideas on New Interactive Map Project " but I thought maybe if I restated it it might make my question more clear. I'll consolidate both posts and mark as solved once I get this figured out!>
_________________
Walter Kempees...you are dearly missed. |