Solved

SQL Query Between Two Letters

Posted on 2013-11-27
4
426 Views
Last Modified: 2013-11-27
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!
0
Comment
Question by:Bob Schneider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Assisted Solution

by:Shaun Kline
Shaun Kline earned 166 total points
ID: 39680685
Add:
AND LEFT(p.LastName, 1) BETWEEN 'A' and 'H'

Open in new window

0
 
LVL 9

Assisted Solution

by:guswebb
guswebb earned 334 total points
ID: 39680689
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
 
LVL 9

Accepted Solution

by:
guswebb earned 334 total points
ID: 39680698
small correction (single quotes)....

select lastname from participant p, partrace rc where p.articipantid=rc.raceid and LEFT(lastname,1) = '[A-H]'
0
 

Author Closing Comment

by:Bob Schneider
ID: 39680716
Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question