J Pistone wrote:
> I'm trying to search a rather large database for someone's last name. The last names are stored
> as such: LASTNAME, FIRSTNAME
> The input text box allows upper or lower case, and only asks for the person's last name (meaning
> multiple hits would be okay). What's the best syntax to search for the last name by using the
> ',' as a delimiter from the database entry?
SELECT
id
FROM people
WHERE
name LIKE ?
in which you substitute the ? with the content of the textbox followed by a %-character
(e.g. 'Jones%')
Like is not case sensitive, unless you have defined the name column BINARY.
Make sure you have an index on the name column.
(but you really shoulb put lastname and firstname in different columns)
--
felix
Please use
BBCode to format your messages in this forum.