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 |
|
bdiddy
Starting Member
2 Posts |
Posted - 2004-06-15 : 12:04:46
|
| I'm sure this is a very remedial question, but i can't seem to figure it out..I have 3 tables: employees (id, name), employeesAllow (userID, employeeID), employeesDeny (userID, employeeID) and each has their very specific purpose. I need a query that will return the records from employeesDeny and the records in the employees table that are not also in the employeesAllow table.so what i'll end up with is all the employees that are not "allowed".Thanks for your help |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-06-15 : 12:09:37
|
| You should have 1 table, employees, with a status code column...anywaySELECT * FROM employees eWHERE Exists (SELECT * FRom deny d e.id = d.id)AND not exists (SELECT * FROM allow a e.id = a.id)Brett8-) |
 |
|
|
bdiddy
Starting Member
2 Posts |
Posted - 2004-06-15 : 12:21:25
|
| Thanks Brett, worked like a charm. |
 |
|
|
|
|
|