Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL LIKE Question 1

Status
Not open for further replies.

powahusr

Technical User
Jan 22, 2001
240
US
I created a simple query that retrieves a group of records based on the first character of the last name specified in the Select Statement, like such:

SELECT EmployeeID, LastName, FirstName
FROM Employee
WHERE LName LIKE 'a%'

However, what I'm really looking to do is retrieve all records based on what letters I specify in the SELECT statement. If I wanted to retrieve all records for people with the last name that start with A, B, C, AND D. How would I tweak the preceding SQL statement to retrieve all matching records that the last name starts with A, B, C, AND D?

Thanks in advance!!!
 
Hi,

Just a word of warning....

If the column only contains alphabetic characters then using '<' will probably work but be aware that:

spc ! &quot; # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9 : ; < > ? @

are all less then 'A' in ASCII

and

spc ¢ . < ( + ! $ * ) ; | & , % _ > ?
- / : # @ ' = &quot; 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

are all less than 'A' in EBCDIC

Regards,

Stoggers.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top