I'm having the next example table as a result of an UNION.

| pk | baseProduct | isPrincipal |
| --- | --- | --- |
| 1 | 10 | 1 |
| 2 | 11 | 1 |
| 3 | 12 | 0 |
| 4 | 13 | 0 |
| 5 | 11 | 0 |
| 6 | 15 | 0 |
| 7 | 29 | 0 |

Some rows with the 'isPrincipal' on true/1 are repeated by same baseProduct, there is another pk product, but they have the same baseProduct.

I want to delete the duplicated baseProducts rows maintaining the isPrincipal pk.

Example;
PK 2 and 5 have the same baseProduct but one of them have the isPrincipal flag, then I want to delete the row with pk 5 that doesn't have the flag.
Is there is no a baseProduct with the isPrincipal flag I want to remain that entry, for example, at this table the PK 5 is the only one I want to remove.

I got this table after an UNION

```
SELECT ( ..... )tbl

```

Can you help me to filter this? My SQL knowledge is pretty low. Thanks!