I have a query in which I select the data I need for a sphinx index. One of the things I do is a concat_ws of multiple name aliases, different languages and such. This presents a problem when the names overlap. For example: one entry has the names "Clannad", and the alternative title "CLANNAD -クラナド-". Another has the names "Clannad After Story", "クラナド アフターストーリー" and "Clannad: After Story". Now bear with me, because I know this would be easily resolved in this particular case, but I'd wish for it to be applicable all over the board. If you search "Clannad" you'll get the After Story entry first because of the double match on 'Clannad'.
What I'd like to do is remove all duplicate words/non-unique words in the concat_ws statement. If that is even possible.
The query looks something like:
SELECT CONCAT_WS(' ',a.Name,a.Name2,a.Name3,a.Name4) AS name
(I hope I structured this question correctly, this being my first here) Thank you,