MySQL Select names with last names starting with certain letter

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-03-11T05:39:43Z Indexed on 2010/03/11 5:48 UTC
Read the original article Hit count: 302

Filed under:

I have a MySQL database with a field Name which contains full names. To select all people with last names starting with a particular letter, let's say A for this example, I use the following query: SELECT * FROM db WHERE Name LIKE '% A%'. However, this also selects users who have a middle name starting with A. Is there anyway to alter this query so that only a last name starting in A will be selected?

© Stack Overflow or respective owner

Related posts about mysql