My goal is to write a code to find the same ID that has different test results. Table 1 contains many rows, but I added these 4 rows as an example. I know my code is not correct, but what would be the correct way of obtaining this specific information? (see Desired Goal below) I hope my question makes sense, but feel free to comment if it is not clear.
Table 1:
| ID | TEST_RESULT | DIAGNOSIS |
|---|---|---|
| 2 | POSITIVE | X78 |
| 2 | NEGATIVE | U98 |
| 3 | POSITIVE | U98 |
| 4 | NFEGATIVE | Y55 |
Desired Goal:
| ID | TEST_RESULT | DIAGNOSIS |
|---|---|---|
| 2 | POSITIVE | X78 |
| 2 | NEGATIVE | U98 |
Code:
SELECT *
FROM table1
WHERE ID <> ' ' AND TEST_RESULT= NEGATIVE AND TEST_RESULT = POSITIVE;