Limit records by number of replicates

1

I have a query as follows, and would like to filter by COUNT

SELECT COUNT(1) AS QTD,
       Nome,
       Cpf
FROM Funcionarios
WHERE QTD >= 2
GORUP BY Nome, Cpf
    
asked by anonymous 03.08.2018 / 15:39

1 answer

5

Try adjusting your query to filter after grouping the data with Having clause:

SELECT COUNT(1) AS QTD,
       Nome,
       Cpf
  FROM Funcionarios
 GROUP BY Nome, Cpf
HAVING COUNT(1) >= 2
    
03.08.2018 / 15:41