I have the following table
people
person_id
first_name
last_name
I want to fetch all the people whose last names occur more than once. Can someone help me with this.
I have the following table
people
person_id
first_name
last_name
I want to fetch all the people whose last names occur more than once. Can someone help me with this.
SELECT
Person_id,
Last_Name,
First_Name,
COUNT(*)
FROM
People
GROUP BY
Person_id,Last_Name,First_Name
HAVING
COUNT(*) > 1
Select *
from persons t1
Join (select t2t1. lastName, count(t2t1. *) 'counted'
from persons t2t1
Group by t2t1. lastName
Having count(t2t1. *) >1
) t2 on t1.LastName=t2. Lastname