Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-03 : 10:01:10
|
| James writes "I'm trying to create a large search process for a matchmaking procedure. Users can fill out information on their age, gender, location etc but what my question pretains to is their interests. Each user can select from a list of interests in different categories. Each category has it's own table in the database so that we can dynamically create new interests as the need arises. At the moment, there are six interest categories all linked into the base table through a series of intersect tables that hold the users id and the id of the selected interest. What I am having troubles with is developing a query that will return user ids where they have two or more specific interests selected to create an AND type of filter. eg. Return all users who have selected interest1 and interest2. This is quite easy to do in an OR filter becuase you are still filtering each row at a time but the AND filter requires the analysis of a rowset. I would like to come up with a way that I can query this other than creating a stored procedure which would sort through a cursor and pick out ids that had both interests present, because I forsee this being quite a large piece of code especially since there are six categories. At the moment a use a series of union selects and IN filters to create a really quick search of all the tables but regardless, this is still an OR type of filter. Any help would be much appreciated" |
|
|
|
|
|