Answers for "How to get distinct sets of rows using SQL (Oracle)?"

SQL
0

How to get distinct sets of rows using SQL (Oracle)?

WITH hashes AS
(SELECT group,
        SUM(Ora_hash(Concat(Concat(account,field), value))) AS hash
 FROM table
 GROUP BY group)
SELECT account,
       field,
       value,
       group
FROM table
WHERE group IN (SELECT group
                FROM (SELECT group,
                             row_number() over (PARTITION BY hash ORDER BY NULL) AS rn
                      FROM hashes)
                WHERE  rn = 1);
Posted by: Guest on January-04-2022

Code answers related to "How to get distinct sets of rows using SQL (Oracle)?"

Code answers related to "SQL"

Browse Popular Code Answers by Language