How can i use count(*) in where clause

I am doing some data cleanup and want to find all contacts which have duplicate records so i group by first and last name which works fine but i want to return only the records where count(*) is > 1.

My current query is

SELECT COUNT(*) AS count, last_name, first_name
FROM Contacts 
WHERE _type = 'contact' 
GROUP by last_name, first_name
order by count DESC

but it does not allow me to use count(*) > 1 or count > 1

SELECT COUNT(*) AS count, last_name, first_name
FROM Contacts 
WHERE _type = 'contact' 
GROUP by last_name, first_name
HAVING COUNT(*) > 1
order by count DESC

OR

SELECT cnt AS count, last_name, first_name
FROM Contacts 
WHERE _type = 'contact' 
GROUP by last_name, first_name
LETTING cnt = COUNT(1)
HAVING cnt > 1
order by cnt DESC
1 Like