Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I am creating a program where i need to match similar names in order to get the results.
Now the problem here is the names can be spelled differently or can be in different order.
I am basically matching hotel names together and lets say for example,
there is one hotel Mariott. Now this name can be spelled differently and since the hotel is in different countries therefore every country might have a different combination, lets say for example in Dubai it is known as Mariott Hotel, Dubai,
in Australia, it is known as Hotel Mariott, Australia, or somewhere it is spelled with one t, like Mariot Hotel.
In actual the program should match all above examples and display the results. So how can i achieve this using SQL.
Need your help.
I would highly appreciate it.

Many Thanks

What I have tried:

Tried searching the web but to no avail
Posted
Updated 14-Feb-17 20:39pm
Comments
[no name] 15-Feb-17 6:53am    
Have maybe a look here for ideas: Query with Full-Text Search[^]
RedDk 15-Feb-17 13:04pm    
Learn what a QUERY is using TSQL first.

It's a tough problem - because many of the examples you give are obvious for humans - but less so for machines. But here are some thoughts that may help:

SQL
SELECT
  SoundEx( 'Mariott' ),
  SoundEx( 'Mariot' )


gives the same results "M630". You need MDS installed (worth checking what you need as I'm no expert) to use this. You'll get some false positives and non-matches - but it's a pretty easy starter for your problem.

For the word order issue (SoundEx will help only with spelling variations and sounds like problems), I would suggest just splitting the hotel name into it's component words and running soundEx on each separately.

Hope this helps,

Jon
 
Share this answer
 
Comments
Faran Saleem 15-Feb-17 6:39am    
Thanks for your reply..but the thing is i am running a match on one single column.. i am not inputting any word.. like there is a table and it has a column hotel_names, so what i need is to run a match on that column and it should display similar results.. and the data is being uploaded on daily basis in that table.
Use LIKE (Transact-SQL)[^], e.g.
WHERE hotelname LIKE '%Mariot%'
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900