📜  如何使用 SQL (Oracle) 获取不同的行集? - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:51.909000             🧑  作者: Mango

代码示例1
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);