I would like to retrieve all rows from a table where there are some records with a duplicated column, but i have to select only one row for those cases.
Example:
-------------------------------------------
| id | text | stringIdentifier |
|-------------------------------------------
| 1 | exampleTEXT1 | NULL |
| 2 | exampleTEXT2 | NULL |
| 3 | exampleTEXT3 | X13UIWF |
| 4 | exampleTEXT3 | X13UIWF |
| 5 | exampleTEXT3 | X13UIWF |
| 6 | exampleTEXT4 | A78BCTK |
| 7 | exampleTEXT4 | A78BCTK |
| 8 | NULL | NULL |
| 9 | NULL | NULL |
-------------------------------------------
Expected output:
-------------------------------------------
| id | text | stringIdentifier |
|-------------------------------------------
| 1 | exampleTEXT1 | NULL |
| 2 | exampleTEXT2 | NULL |
| 3 | exampleTEXT3 | X13UIWF |
| 6 | exampleTEXT4 | A78BCTK |
| 8 | NULL | NULL |
| 9 | NULL | NULL |
-------------------------------------------
Notes:
- I can select any row from the set of records with the same
stringIdentifier
- Only column
id
isPRIMARY KEY
- It could be rows with
text = NULL
andstringIdentifier = NULL
Thanks in advance.