Ordering words in a string alphabetically

dougmcc1

Registered User.
Local time
Today, 15:17
Joined
Jul 29, 2004
Messages
27
I have two tables in my database. Both of them have strings which are up to 5-6 words long. I want to make sure that the strings in one table dont exist in the other even if the words within the strings are arranged differently.

So how would I select a string from both tables and re-arrange them so that the words in each string are ordered alphabetically? If I could do this I should be able to make a direct comparison to prevent duplicate entries.

Thanks.
 
Put each word in one record instead of putting all the words in one string.
 
Hmm good idea. The only thing is I'd to have to have 5-6 cells just for one string though. Also, it's possible that I might get strings that are more than 5-6 words so I'd have to accomodate for those as well...

Any other ideas?
 
tblString

StringID (A)
StringNum (B)
StringText (C)


Wouldnt that work?
Code:
A   B      C
1    1     Abba
2    1     Babba
3    1     Cabba
4    1     Fabba
5    1     Zabba
10   2     abbr
7    2     babbr
9    2     cabbr
8    2     fabbr
6    2     zabbr
 
Couldnt you have the string in separate pieces in its own table and order it that way and also index it to eliminate all the strings that are duplicates.
 

Users who are viewing this thread

Back
Top Bottom