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
you can use the self join to
Fri, 09/03/2010 - 13:44 — adminyou 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