4

I am trying to find out how many duplicate records I have in a table. I can use count, but I'm not sure how best to eliminate records where the count is only 1.

select first_name, last_name, start_date, count(1) from employee group by first_name, last_name, start_date; 

I can try to order by the count, but I am still not eliminating those with a count of one.

1 Answer 1

5

you can use having clause as having Count(*) > 1 after group by like this :

select first_name, last_name, start_date, Count(*) AS Count from employee group by first_name, last_name, start_date having Count(*) > 1 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.