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 |
|
Danny__T
Starting Member
27 Posts |
Posted - 2004-09-15 : 05:25:45
|
| I have the following view and tablevwMatcheduserIdjobIdotherFieldstblExcludeuserIdjobIdthe exclude table is a lookup table of jobs that have been matched to a user that they are not interested in. How can I query my view to retrieve ALL distinct userId and job combinations UNLESS that user and that job combination is in the exclude table?Cheers, |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-15 : 05:33:43
|
something like:select t1.*from vwMatched t1 left join tblExclude t2 on t1.UserId = t2.UserId and t1.jobId = t1.jobIdwhere t2.jobid is null and t2.userid is nullGo with the flow & have fun! Else fight the flow |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2004-09-15 : 05:34:36
|
| SELECT DISTINCTvm.userId, vm.jobIdFROM vwMatched AS vmLEFT JOIN tblExclude AS eON vm.userId = e.userIdAND vm.jobId = e.jobIdWHERE e.userId IS NULLMark |
 |
|
|
|
|
|