September 21st, 2000, 08:19 AM
Hi, I'm having two tables a person and a profile table. The profile consist of categories, and each person can be in one or more categories. And now I want to be able to find persons based on their profile.
If I searc on one category in the profile table it works fine, but not if I want to search on multiple categories.
select Name from A, B where B.cat1 = 'y' and A.id = B.id
That work fine, but this selects all persons in the database
select Name from A, B where B.cat1 = 'y'OR B.cat2 = 'y' and A.id = B.id
I really can't get my head around this, any help is appreciated.
September 21st, 2000, 09:19 AM
You need some parenthesis in there:
select Name from A, B where (B.cat1 = 'y'OR B.cat2 = 'y') and A.id = B.id