When querying a table in Oracle Dev I need to ignore any ID that doesn't have a null date.
An ID can be returned multiple times e.g. 5 times, 4 can have a null date but one might have 01.01.2022 in which case all of them need to be ignored.
Here is the SQL:
SELECT
ID,
ACTIVATION_DATE,
ACCEPTED_DATE
FROM TABLE
WHERE ACCEPTED_DATE IS NOT NULL
--AND ACTIVATION_DATE IS NULL
AND ID IN ('AA1','AA2');
And the result:
| ID | ACTIVATION_DATE | ACCEPTED_DATE |
|---|---|---|
| AA1 | 01/04/2022 | |
| AA1 | 15/03/2022 | |
| AA1 | 22/08/2022 | 07/06/2022 |
| AA1 | 11/05/2022 | |
| AA2 | 06/06/2022 | |
| AA2 | 25/09/2022 | 12/12/2021 |
You can see AA1 has pulled 4 rows but because it has one activation date, they now all need to be ignored. If I leave AND ACTIVATION_DATE IS NULL in there it will still return the blank rows, which need to be ignored altogether.
Assume this will need to be a subquery? Any help would be much appreciated!
I have tried the SQL query as above
ACCEPTED_DATEhave different date that you get four same rows, in otherACTIVATION_DATErows are just blank in table i think