Solved

MySQL soundex query help

Posted on 2007-11-20
1
521 Views
Last Modified: 2013-12-13
I have a search page with the following query that will return an exact match for a surname.  How do I adjust this query to allow for a check box, than when checked will return Soundex values. If it is left unchecked it returns an exact match. (i.e. this code returns all Snyders --  "Select Surname FROM database WHERE Soundex(Surname) = Soundex('Snider');"

Of course I want the user to be able to enter any surname, not just Snider!

Thanks Experts!
0
Comment
Question by:geist62
1 Comment
 
LVL 25

Accepted Solution

by:
imitchie earned 500 total points
ID: 20325471
will this work?
where @checked is whether or not the box is ticked,
 and @input is the surname being searched

Select Surname FROM database
WHERE
  (1=@checked and Soundex(Surname) = Soundex(@input)) or
  (0=@checked and Surname = @input)
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question