CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [Resolved] SQL Question - Query with Many-To-Many

Print topic Send  topic

Author Message
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.
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 09/19/2008, 3:59 AM

Yes Support resolved this for me. for more see this post,

http://forums.yessoftware.com/posts.php?post_id=100296
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.