On 4/5/2010 3:00 PM, Peter Geoghegan wrote:
>> http://www.postgresql.org/docs/8.4/static/fuzzystrmatch.html
>>
>> --
>> Bill Moran
>> http://www.potentialtech.com
>> http://people.collaborativefusion.com/~wmoran/
>
> Fuzzystrmatch is generally used to compare two single words for how
> similar they sound. How can that actually be applied to get the
> functionality that I've described?
>
> Regards,
> Peter Geoghegan
>
You could use regexp_split_to_table to split words, then soundx each
one, and find matching... assuming you have a table like:
andy=# select * from tmpx;
id | cname
----+-----------------
1 | andy corp
2 | cola corp
3 | pepsi cola corp
4 | bob inc
(4 rows)
(I dont have the soundx stuff installed, so I'll uppercase instead)
andy=# select id from (select id, upper(regexp_split_to_table(cname,
E'\\s+')) as sndx from tmpx) as foo where sndx = 'CORP';
id
----
1
2
3
(3 rows)
and actually, you probably want "select distinct id from..."
-Andy