Hi, You are doing everything fine, however, soundex is not a perfect system and does not always work. It does simplify some types of queries. But in the vast majority of cases I don't think that it is worth the bother.
It doesn't actually link all the same sounding sirnames, if there were a system like that life would be nice and simple, however (and correct me if I am wrong) there isn't one. Soundex was an attempt and it doesn't really work. It is used by the US government but it just means you have to search under a couple of different soundex codes rather than searching under 8 or 9 different spellings. See this example. mysql> select soundex('morton'), soundex('moreton'), soundex('morten'); +-------------------+--------------------+-------------------+ | soundex('morton') | soundex('moreton') | soundex('morten') | +-------------------+--------------------+-------------------+ | M635 | M635 | M635 | +-------------------+--------------------+-------------------+ 1 row in set (0.00 sec) mysql> select soundex('callaghan'), soundex('callahan'), soundex('calahan'); +----------------------+---------------------+--------------------+ | soundex('callaghan') | soundex('callahan') | soundex('calahan') | +----------------------+---------------------+--------------------+ | C425 | C450 | C450 | +----------------------+---------------------+--------------------+ 1 row in set (0.00 sec) mysql> I hope this helps. Richard >> I want to use SOUNDEX for name queries, but I don't >> seem to be doing it correctly. >> As a test, I made a small table and popluated it >> with my name. My goal is to be able to find my name >> 'Callaghan', with its most common misspelling >> 'Callahan'. >> I've read the MySQL doc, so I know how to actually >> invoke soundex at the mysql prompt. I read an >> article that said soundex queries move more quickly >> if you add a column for the soundex. >> Thus: >> CREATE TABLE sound ( >> id tinyint(3) NOT NULL auto_increment, >> name varchar(100) default NULL, >> sound varchar(100) default NULL, >> PRIMARY KEY (id) >> ) TYPE=MyISAM; >> select soundex('Callaghan'); >> result = C425 >> INSERT INTO sound VALUES (1, 'Callaghan', 'C425'); >> Simple enough. Now, I expected all three of the >> following queries to return a value. >> select id from sound where sound = >> soundex('Callaghan'); >> returns 1 records >> select id from sound where sound = >> soundex('Callahan'); >> returns 0 records >> select id from sound where name = >> soundex('Callaghan'); >> returns 0 records >> I'm missing something obvious here, but I've read >> the doc and I'm not sure what's wrong. >> -- >> Get your free email from www.linuxmail.org >> Powered by Outblaze >> --------------------------------------------------------------------- >> Before posting, please check: >> http://www.mysql.com/manual.php (the manual) >> http://lists.mysql.com/ (the list archive) >> To request this thread, e-mail <[EMAIL PROTECTED]> >> To unsubscribe, e-mail >> <[EMAIL PROTECTED]> >> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php