How can I find strings in a table where the first character is a number?
I'm using MySQL LIKE as follows
SELECT DISTINCT label_no_country
FROM releases
WHERE label_no_country LIKE '$letter%'
ORDER BY label_no_country
where $letter
is a letter between A-Z (depending on the input)
So if $letter == 'A'
then it will show all entries where the first letter is A.
How can I run this query so that it will show records that start with numbers?
e.g.
1st record
cheers!
You might want to use Regular Expressions:
SELECT DISTINCT label_no_country FROM releases
WHERE label_no_country
REGEXP '^[0-9]'
See MySQL docs for details.
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