Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-19-2007, 04:48 AM   PM User | #1
reubenb
Regular Coder

 
Join Date: Sep 2002
Location: Adelaide, Australia
Posts: 472
Thanks: 3
Thanked 0 Times in 0 Posts
reubenb is an unknown quantity at this point
next record filter

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.

Last edited by reubenb; 12-19-2007 at 04:55 AM.. Reason: realised i was asking for something else
reubenb is offline   Reply With Quote
Old 12-19-2007, 11:00 AM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
http://www.cryer.co.uk/brian/sql/sql_crib_sheet.htm

Code:
select field1, field2, count(*) from TableName
group by field1, field2
having count(*) > 1
Spudhead is offline   Reply With Quote
Old 12-19-2007, 11:12 AM   PM User | #3
reubenb
Regular Coder

 
Join Date: Sep 2002
Location: Adelaide, Australia
Posts: 472
Thanks: 3
Thanked 0 Times in 0 Posts
reubenb is an unknown quantity at this point
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?
reubenb is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:39 PM.


Advertisement
Log in to turn off these ads.