I need your precious help :-)
Imagine the ZAP_TEST_AP table composed of columns A1, B1 and C1 which contains the info shown in the image below
| row number | A1 | B1 | C1 |
|---|---|---|---|
| 1 | PRIMARY | 11111 | host1 |
| 2 | PRIMARY | (null) | host1 |
| 3 | (null) | (null) | host1 |
| 4 | PRIMARY | 22222 | host2 |
| 5 | (null) | 22222 | host2 |
| 6 | (null) | (null) | host2 |
| 7 | PRIMARY | (null) | host3 |
| 8 | (null) | (null) | host3 |
| 9 | (null) | 44444 | host4 |
| 10 | (null) | (null) | host4 |
| 11 | (null) | (null) | host5 |
my goal is to make a query that is able to extract only the rows 1,4,7,9:
| row number | A1 | B1 | C1 |
|---|---|---|---|
| 1 | PRIMARY | 11111 | host1 |
| 4 | PRIMARY | 22222 | host2 |
| 7 | PRIMARY | (null) | host3 |
| 9 | (null) | 44444 | host4 |
that is to say:
in the case in which (rows 1,2,3) for the same host1 (field c1) I have three rows where for one there are both a1 and b1, one both null and one where only a1 is set, I would like to extract only the one where both are present --> row 1
in the case in which (rows 4,5,6) for the same host2 (field c1) I have three rows where for one there are both a1 and b1, one both null and one where only b1 is set, I would like to extract only the one where both are present --> row 4
in the case in which (rows 7,8) for the same host3 (field c1) I have two rows where for one they are both null and one where only a1 is set, I would like to extract only the one where a1 is set --> row 7
in the case in which (rows 9,10) for the same host4 (field c1) I have two rows where for one they are both null and one where only b1 is set, I would like to extract only the one where b1 is set --> row 9
in case (row 11) for host5 (field c1) I have only one row and both a1 and b1 are null, I would like it not to be extracted
I hope I have clearly explained my problem :-(
Thanks in advance for your cooperation !!!

nullvalues in all columns? Which row do you want to pick then? Similarly, if for another host thea1value is alwaysnull, theb1value is always non-null, but there are several rows (for the same host, all witha1beingnull), with distinct, non-nullvalues forb1? Which particular row from those rows do you want to pick?a1is non-nullandb1isnull, and in the othera1isnullandb1is non-null? Which of these rows do you pick then?