how do i display non distinct or duplicate records in sql?

You can use the GROUP BY clause that hasn’t been introduced too long ago. Example:

SELECT s.requiredvalue
FROM (
    SELECT f.requiredvalue, COUNT(1) AS count
    FROM c
    JOIN f IN c.array1
    WHERE c.primarycode='0000001'
    GROUP BY f.requiredvalue
) s
WHERE s.count > 1

edit: hereby also a query to get the overlapping requiredvalue for every primarycode

SELECT s.primarycode, s.requiredvalue
FROM (
    SELECT c.primarycode, f.requiredvalue, COUNT(1) AS count
    FROM c
    JOIN f IN c.array1
    GROUP BY c.primarycode, f.requiredvalue
) s
WHERE s.count > 1

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top