Hi All,
I have a table consisting a list of students, which has two fields , serialno and name.
I need a list of all records in this table where the SerialNo field is the same but the name are not the same.
So for instance:
select SerialNo , firstname from school where SerialNo = '1'
Returns:
SerialNo name
1 sHamjith
1 shamjith
1 Shamjith
In this case the query should return serialno=“1” since the name in the first row with “1” does not match the firstname in the second row.
I tried using the following query, but it only works if the names are completely different. It does not work when the names only differ by capitalization:
select SerialNo, count(SerialNo)
from school
group by SerialNo
having
count(SerialNo) > 1 AND
min(name) <> max(name)
order by count(SerialNo) desc
Samproo