SQL to restrict rows by first letter / number
Thicky question.
Say you have names for bands and you want to display all that begin with a specific letter.
# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Easy, you can:
SELECT band_name
FROM bands
WHERE band_name LIKE 'A%'
But what if you want to have # select all bands that don't begin with A - Z ( e.g. they begin with a number).
such as 22 Jacks, or 1080?
Using one piece of SQL to handle the trivial A-Z and the # option without going mental silly?
__________________
By the time you finish reading this sentence, the national debt will have risen by another £1,500 - which you or your children will have to repay.
Just so you know.
|