This might clarify or confuse a bit more what my predecessors wrote.
It's SQL. And Vertica is one of the databases that support the ANSI 2003 standard, the one with "window based" functions, also called OLAP functions. That's the ones that add an OVER() clause after a function call. Just as Gordon said above - this query actually works - and I just insert your very input data into the first Common Table Expression - the first entry list of the initial WITH clause.
Here goes:
WITH -- your input ....
input(grp,caseno,p1,p2,p3) AS (
SELECT 'A', 11,'x','x','x'
UNION ALL SELECT 'A', 12,'x','x','x'
UNION ALL SELECT 'C', 21,'x','x','y'
UNION ALL SELECT 'E',323,'y','y','y'
UNION ALL SELECT 'E', 43,'y','y','y'
)
,
find_dups AS (
SELECT
*
, COUNT(*) OVER(PARTITION BY grp,p1,p2,p3) AS occ_count
FROM input
)
SELECT * FROM find_dups;
-- out grp | caseno | p1 | p2 | p3 | occ_count
-- out -----+--------+----+----+----+-----------
-- out A | 11 | x | x | x | 2
-- out A | 12 | x | x | x | 2
-- out C | 21 | x | x | y | 1
-- out E | 323 | y | y | y | 2
-- out E | 43 | y | y | y | 2
-- out (5 rows)
-- out
-- out Time: First fetch (5 rows): 17.462 ms. All rows formatted: 17.514 ms
And: from here on, you can filter by 'occ_count', identify the biggest
number of duplicates ordering by occ_count, or whatever you finally need.