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 |
evanburen
Posting Yak Master
167 Posts |
Posted - 2015-04-07 : 14:05:08
|
I have a groups of data like in the example below and I want to identify the borrower numbers where none of their tag values = 'dNoRehab'. So in this example, this borrower number would not be in the results because one of the tag values = 'dNoRehab'This is what I have but it's not working for meSELECT DISTINCT [Part1].BorrowerNumberFROM [Part1]WHERE [Part1].Tag NOT IN(SELECT [Part1].BorrowerNumber FROM [Part1] WHERE [Part1].Tag = 'dNoRehab') |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-04-07 : 14:16:19
|
It's because you are using the wrong column here: WHERE [Part1].Tag. Switch it to BorrowerNumber. I would use NOT EXISTS though.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
evanburen
Posting Yak Master
167 Posts |
|
|
|
|