943,861 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 1195
  • MS SQL RSS
Sep 4th, 2008
0

Finding possible matches

Expand Post »
Hi, lets say I have the following 7 records in my database

ID Model
-- ------
1 400
2 400FL
3 400 FL
4 ABC
5 SGH500
6 SGH-500
7 SGH 500

How is it possible if i could select out the rows which are of possible match to some other rows?

E.g. IDs 1, 2 & 3 are possible matches of one another and IDs 5, 6 & 7 are possible matches of one another. ID 4 will not be displayed in the result.

Thanks a lot in advanced
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MaMaMiYa is offline Offline
1 posts
since Sep 2008
Sep 5th, 2008
0

Re: Finding possible matches

Use the LIKE keyword in your SELECT statement.
sql Syntax (Toggle Plain Text)
  1. SELECT Model FROM Table WHERE Model LIKE '%00';

Experiment with that. You may also be able to use regular expressions in the LIKE constraint.
Last edited by peter_budo; Sep 7th, 2008 at 8:47 am. Reason: Keep It Organized - please use [code] tags
Reputation Points: 94
Solved Threads: 8
Practically a Master Poster
khess is offline Offline
638 posts
since Apr 2008
Feb 2nd, 2009
0

Re: Finding possible matches

Using the like constrait with '%00' would work for this sample, but would still require the human eye to make the associations with each possible duplicate. I'm not exactly sure what the solution would be for something with 60,000 records, but I have a feeling it will take more than one query for this kind of scenario. I too have some duplicate records to deal with (hence 60,000 records) and was hoping to stumble on a solution as well. I'm thinking about trying to do something with a pivot table or a custom tool. If I find something I will be sure to post back my results.
Reputation Points: 12
Solved Threads: 6
Junior Poster
Geek-Master is offline Offline
156 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: No pubs database after installing Mssql 2000
Next Thread in MS SQL Forum Timeline: RowGuidCol and Data_located_on_filegroup





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC