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
 Transact-SQL (2000)
 Need Help with a Query

Author  Topic 

wags317
Starting Member

1 Post

Posted - 2005-09-19 : 16:38:29
Here is some sample Data from the table I am using.

User_id Cabinet_id user_right_id
106 106 4
106 107 4
106 110 4
106 111 4
106 112 4
106 113 4
106 114 4
106 115 4
277 162 10
277 162 11
277 164 4
277 164 8
277 164 10
277 164 11
277 165 4
277 165 8
277 165 10
277 165 11

Is their a way I can query this table and find out what user_id and cabinet_id doesn't have an 11 user_right_id? thanks

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-09-19 : 16:45:25
SELECT outr.User_id, outr.Cabinet_id
FROM tbl AS outr
WHERE NOT EXISTS(
SELECT * FROM tbl AS innr
WHERE innr.user_right_id = 11
AND outr.User_id = innr.User_id
AND outr.Cabinet_id = innr.Cabinet_id )
Go to Top of Page
   

- Advertisement -