Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
devizerosoft
Starting Member
2 Posts |
Posted - 2014-01-22 : 04:43:42
|
Please find the below things. I need the SQL Query to find a probability for matching names from one column to another. [Location] is your column that you use to search [wellname]. AYou are to write SQL that best finds the most closely matching name.Your code must be dynamic to accommodate a larger data set./*Problem base table build*/DECLARE @basedata TABLE (id int identity(1,1), Location varchar(100), WellName varchar(100))INSERT INTO @basedata (Location, wellname) VALUES(' A BURROWS 1','26258-0134 A BURROWS UNIT NO 1 M0192');INSERT INTO @basedata (Location, wellname) VALUES(' A BURROWS 1','26777-0134 DELONG #1 M4134');INSERT INTO @basedata (Location, wellname) VALUES(' A BURROWS 1','BURROWS UNIT NO 1');INSERT INTO @basedata (Location, wellname) VALUES('A.O. MANGLES 1','26258-0466 A O MANGELS WELL #1 M4466');INSERT INTO @basedata (Location, wellname) VALUES('A.O. MANGLES 1','26777-0466 A.O. MANGELS WELL #2');INSERT INTO @basedata (Location, wellname) VALUES('A.O MANGLES 1-2','26777-0466 A MANGELS WELL #2');INSERT INTO @basedata (Location, wellname) VALUES('A.O MANGLES 1-2','26777-0466 A.O. MANGELS WELL 1 #2');INSERT INTO @basedata (Location, wellname) VALUES('A.O MANGLES 1-2','26777-0466 A O MANGELS WELL #2');INSERT INTO @basedata (Location, wellname) VALUES(' ALLEN EST. 1 ','26777-0103 ALLEN ES.T UNIT WELL #1 M4103');INSERT INTO @basedata (Location, wellname) VALUES(' ALLEN EST. 1 ','26777-0103 ALLEN ESTATE UNIT WELL #1 M4103');INSERT INTO @basedata (Location, wellname) VALUES('Lateral C;1 Discharge:','C1 Jones');INSERT INTO @basedata (Location, wellname) VALUES('Lateral C;1 Discharge:','C Lateral 2');INSERT INTO @basedata (Location, wellname) VALUES('Lateral C;1 Discharge:','Discharge;Lateral1C');INSERT INTO @basedata (Location, wellname) VALUES('Lateral C;1 Discharge:','Lateral C Dis');Results:Please help me... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-22 : 08:16:14
|
looks like an assignment question. can we see hwta you tried yet?without an attempt from your end we wont help in assignment questions------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|