MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:daniel.gardner Date:June 28 1999 9:58pm
Subject:RE: soundex support with PERL
View as plain text  
If the algorithms are different you can always use just the mysql one:

select * from donor where WHERE soundex(donor_surname) = 
soundex('Niedermayer')

should do it.

dan

> -----Original Message-----
> From: dniederm@stripped [mailto:dniederm@stripped]
> Sent: 28 June 1999 22:41
> To: mysql@stripped
> Cc: dniederm@stripped
> Subject: FW: soundex support with PERL
> 
> 
> Mysql's soundex algorithm seems different than the one coming 
> with PERL,
> making a match in some cases impossible.
> 
> Here is the SQL query followed by the value returned from the 
> web page:
> 
> mysql> select donor_surname, soundex(donor_surname) from donor;
> +---------------+------------------------+
> | donor_surname | soundex(donor_surname) |
> +---------------+------------------------+
> |               |                        |
> |               |                        |
> | Niedermayer   | N3656                  |
> | Niedermayer   | N3656                  |
> | King          | K520                   |
> | King          | K520                   |
> | King          | K520                   |
> | King          | K520                   |
> | Sundberg      | S53162                 |
> | Dumpty        | D513                   |
> | King          | K520                   |
> | Frasier       | F626                   |
> | Kingman       | K525                   |
> +---------------+------------------------+
> 13 rows in set (0.01 sec)
> 
> ====================
> Searching on "Niedermayer" as a textbox on an HTML form and 
> viewing the
> resulting query, we get:
> ====================
> 
> SQL is: SELECT donor_id, donor_firstname, donor_initial, donor_title,
> donor_surname, donor_address1, donor_address2, donor_address3,
> donor_dayphone,
> donor_evephone FROM donor WHERE soundex(donor_surname) = 'N365'
> 
> ====================
> The code is:
> 
> ...
> use Text::Soundex;
> ...
>   SWITCH: {
>     if ( $search_type eq "soundex" ) {
>       $SQL        = qq(SELECT donor_id, donor_firstname,
>                   donor_initial, donor_title,
>                               donor_surname, donor_address1,
>                   donor_address2, donor_address3,
>                   donor_dayphone, donor_evephone
>                  FROM   donor
>                WHERE  );
>       if ($query->param('donor_surname') ne "" ) {
>         $donor_surname  = soundex($query->param('donor_surname'));
>         $SQL    = $SQL . qq(soundex(donor_surname) = 
> '$donor_surname');
>         if ($query->param('donor_firstname') ne "") {
>           $SQL= $SQL . " AND ";
>         }
>       }
>       if ($query->param('donor_firstname') ne "" ) {
>           $donor_firstname= soundex($query->param('donor_firstname'));
>         $SQL    = $SQL . qq(soundex(donor_firstname) =
> '$donor_firstname');
>       }
>       last SWITCH;
>     }
> 
> ============================
> My question: is there a way to force a match?
> 
> --
> 
> ********************************
> Daryle Niedermayer
> Consultant
> GDS & Associates Systems. Ltd.
> 400 - 4211 Albert St.
> Regina, SK Canada -- S4S 3R6
> Phone: 306.586.7832
> Fax: 306.585.1514
> email: dniedermayer@stripped
> http://www.gds.ca
> ********************************
> 
> 
> 

Thread
soundex support with PERLDaryle Niedermayer29 Jun
  • Re: soundex support with PERLBenjamin Pflugmann30 Jun
RE: soundex support with PERLdaniel.gardner29 Jun
  • RE: soundex support with PERLDaryle Niedermayer29 Jun