Solved

MySQL soundex query help

Posted on 2007-11-20
1
517 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

930 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now