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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Mulitple values to be checked

Author  Topic 

kevkev
Starting Member

3 Posts

Posted - 2004-03-04 : 16:08:44
say I have an person table(personID) and I also have a permission table (with permissionID, personID). how can I find all of the who have permission ID '2' and permission ID '3' but only return the person ID once?

would I use 2 inner joins and inner join on the results of the first query?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-04 : 16:14:16
Please provide sample data plus expected result set of the sample data.

It sounds like you need to use an INNER JOIN with a GROUP BY.

Tara
Go to Top of Page

nfsoft
Starting Member

36 Posts

Posted - 2004-03-04 : 17:24:47
PERSON(personID,name,...)
PERMITION(permitionID, personID)

SELECT A.personID
from PERMITION A
inner join PERMITION B on A.personID=B.personID and A.permitionID=2 and B.permitionID=3

hope helps

Nuno Ferreira
Go to Top of Page
   

- Advertisement -