Solved

MySQL soundex query help

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 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

17 Experts available now in Live!

Get 1:1 Help Now