I want to run query like below
select distinct (columnA, columnB, columnC), columnD from MY_TABLE where columnA IS NOT NULL AND columnB IS NOT NULL AND columnC is NOT NULL;
I only want distinct of columnA, columnB and columnC and NOT ON columnD. But SQL developer is pointing an error right after columnA, How can I fix this?
I tried to fix my query using GROUP BY
select columnA, columnB, columnC, (select count(*) from TABLE2 WHERE table2columnA = myTable.columnA) from MY_TABLE myTable where columnA IS NOT NULL AND columnB IS NOT NULL AND columnC is NOT NULL GROUP BY columnA, columnB, columnC;
Notice that my columnD is actually another select statement? But this is giving me error
ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
This is not a duplicate of that another question