View Single Post
Old 10th July 2008, 13:15   #6
DimPrawn
Godlike
 
DimPrawn's Avatar
 
Join Date: Jul 2005
Posts: 10,101
Default

Quote:
Originally Posted by expat View Post
SELECT band_name
FROM bands
WHERE UPPER(substr(band_name,1,1)) < 'A'
OR UPPER(substr(band_name,1,1)) > 'Z'

This uses Oracle's UPPER(string) to convert to upper case, your flavour of SQL will doubtless have something like it (I presume that you want a case-independent test).
Great but you haven't read the requirement have you?

There is one parameter, either the letter I want or everything that does not start with a letter (# passed in) in one simple, efficient, fast SQL statement.

I know SQL very well and it's pretty obvious how to select everything that's not A to Z.

__________________
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.
DimPrawn is offline   Reply With Quote