SQL Query Between Two Letters

How can I query all data where a field where all values (first letter) are between to alpha characters.  Say I want to query where the last name is between "A" and "H".

Here is the query I need to filter:

sql="SELECT p.LastName FROM Participant p INNER JOIN PartRace rc ON rc.ParticipantID = p.ParticipantID WHERE rc.RaceID = " & lWhichRace

Thanks!
Bob SchneiderCo-OwnerAsked:
Who is Participating?
 
guswebbConnect With a Mentor Commented:
small correction (single quotes)....

select lastname from participant p, partrace rc where p.articipantid=rc.raceid and LEFT(lastname,1) = '[A-H]'
0
 
Shaun KlineConnect With a Mentor Lead Software EngineerCommented:
Add:
AND LEFT(p.LastName, 1) BETWEEN 'A' and 'H'

Open in new window

0
 
guswebbConnect With a Mentor Commented:
Assuming the field upon which you want to perform the A - H check is lastname, use...

select lastname from participant p, partrace rc where p.articipantid=rc.raceid and LEFT(lastname,1) = [A-H]
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.