programming faqs interview questions tech technical educational freshers guide preparation interviews hr telephonic
try another color:
try another fontsize: 60% 70% 80% 90%
Programming FAQs

How to find the duplicate rows by comparing two columns in a table mysql

Average: 3 (1 vote)

you can use the self join to

you can use the self join to retrieve the duplicate records in a table by comparing two columns,

I want to find out the students who has the same Firstname and last name

SQL:

SELECT
DISTINCT n1.id source_row,n1.firstname,n1.lastname,
n1.login , n1.password
FROM
students n1 JOIN students n2 ON
n1.firstname = n2.firstname AND
n1.lastname = n2.lastname AND
n1.id != n2.id