...

View Full Version : next record filter



reubenb
12-19-2007, 05:48 AM
Hi.

How can I show duplicates of two fields, like the same of the firstname and lastname?
For example if I have;

firstname lastname
John Smith
John Smith
Michael Owen
Michael Smith

it would show me... so the user can view them and delete the one thats wrong.
John Smith
John Smith

I found a way to do this, but it only would show the first of the duplicate entries. I need it to show all of them.

Spudhead
12-19-2007, 12:00 PM
http://www.cryer.co.uk/brian/sql/sql_crib_sheet.htm


select field1, field2, count(*) from TableName
group by field1, field2
having count(*) > 1

reubenb
12-19-2007, 12:12 PM
that works, but it only gives me one record that is duplicated. there are other fields that are different.

(in my db, if there are two records, mostly a lot of the other fields would be completed, but in another there would only be a few [incomplete])

in my original example, your code outputs
'John Smith'
where I want it to output
'John' | 'Smith'
'John' | 'Smith'

any idea?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum