Greetings all,
I have a situation where I created a UNION query to generate a distinct list of items from multiple tables. However, as part of the query, it generated some combinations that have some null fields that I would like to get rid of to clean it up. The problem is, I don't want to get rid of the partial null rows where that is the only row for the ID (see example below).
Example:
Desired Outcome:
I would like to use something similar to the following type of comparison to clean up a query:
The problem is, running this gets rid of all TEXTFIELD = Null rows, not just the ones that I want to get rid of. I also tried this:
But then it gets rid of all of the non-Null fields. If I try using a WHERE statement, it doesn't like it. Any ideas?
I have a situation where I created a UNION query to generate a distinct list of items from multiple tables. However, as part of the query, it generated some combinations that have some null fields that I would like to get rid of to clean it up. The problem is, I don't want to get rid of the partial null rows where that is the only row for the ID (see example below).
Example:
ID.....................TEXTFIELD
123...................
ABC..................
ABC..................blah blah blah
Desired Outcome:
ID.....................TEXTFIELD
123...................
ABC..................blah blah blah
I would like to use something similar to the following type of comparison to clean up a query:
Code:
SELECT SAMPLE.[ID], SAMPLE.[TEXTFIELD]
FROM SAMPLE
WHERE (((SAMPLE.[TEXTFIELD]) Is Not Null)) OR (((SAMPLE.[TEXTFIELD]) Is Null))
GROUP BY SAMPLE.[ID], SAMPLE.[TEXTFIELD]
HAVING (((Count(SAMPLE.[ID]))>1)) OR (((Count(SAMPLE.[ID]))=1));
The problem is, running this gets rid of all TEXTFIELD = Null rows, not just the ones that I want to get rid of. I also tried this:
Code:
SELECT SAMPLE.[ID], SAMPLE.[TEXTFIELD]
FROM SAMPLE
GROUP BY SAMPLE.[ID], SAMPLE.[TEXTFIELD]
HAVING (((SAMPLE.[TEXTFIELD]) Is Not Null) AND ((Count(SAMPLE.[ID]))>1)) OR (((SAMPLE.[TEXTFIELD]) Is Null) AND ((Count(SAMPLE.[ID]))=1));
But then it gets rid of all of the non-Null fields. If I try using a WHERE statement, it doesn't like it. Any ideas?