Group by not reducing duplicate fields [on hold]
Clash Royale CLAN TAG#URR8PPP
Group by not reducing duplicate fields [on hold]
I have am trying to create a table and having issues with Duplicates. I've tried to remove them through a Max around the two date fields causing issues, and applying a group by. This does not work. I have done testing to make sure it's not other fields.
I've tried stripping out all the other fields in the group by except the two date fields, and that throws an
ORA-00979 : not a GROUP BY expression error.
If I remove the group by around the constants, that doesn't cause an error, just does nothing.
What else can I try?
Thanks!
SELECT
'constant1',
field1,
'constant2',
field2,
MAX(TRUNC(datefield3)),
field4,
MAX(TRUNC(datefield5)),
'constant3',
functionfield6,
TRUNC(SYSDATE),
substr(Function1(),1,2)
From (tables) WHERE (criteria)
group by
'constant1',
field1,
'constant2',
field2,
MAX(TRUNC(datefield3)),
field4,
MAX(TRUNC(datefield5)),
'constant3',
functionfield6,
TRUNC(SYSDATE),
substr(Function1(),1,2);
This question appears to be off-topic. The users who voted to close gave this specific reason:
select DISTINCT ... from ... where
Please edit your question to define exactly what “doesn’t work” means. Ideally you would include an MCVE and minimise your query to the bare minimum that can demo your problem - eg, do you really need two constant fields in your select???
– Bohemian♦
6 hours ago
Why doesn't
select DISTINCT ... from ... where
do the job?– Littlefoot
6 hours ago