In MS Visual Studio, I have following table 1, where I want to remove duplicate caseNum based on PrimIndicator column. If case number has a duplicate caseNum, I want to keep the row with "True" PrimIndicator, if caseNum is not duplicate then keep the CaseNum.

Table1:

```
ID  CaseNum PrimIndicator
1   AAA-123 TRUE
2   AAA-123 FALSE
3   BBB-546 
4   CCC-753 TRUE
5   CCC-753 
6   ABC-347 
7   DEF-546 TRUE
8   DEF-346 

```

Want Table2:

```
ID  CaseNum PrimIndicator
1   AAA-123 TRUE
3   BBB-546 
4   CCC-753 TRUE
6   ABC-347 
7   DEF-546 TRUE

```

So far I have tried this but it seems that max() function is not working if the PrimIndicator is blank.

```
Select ID, distinct CaseNum, Max(PrimIndicator)
from Table1
group by CaseNum, PrimIndicator

```