Solved

MySQL soundex query help

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

813 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

14 Experts available now in Live!

Get 1:1 Help Now