SELECT * FROM `people` WHERE first_name like 'm%' and last_name like 'm%';
- this selects people with with the same first and last name, but that's for m only. How to select all such people from a to z (order by desc is not a matter)?
SELECT * FROM `people` WHERE UPPER(LEFT(first_name, 1)) = UPPER(LEFT(last_name, 1))
Explanation: takes the leftmost 1 character of first name and of last name, converts them to uppercase, and compares them.
SELECT * FROM people WHERE LEFT(first_name, 1) = LEFT(last_name, 1);
ORDER BY last_name, first_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With