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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query a number series ending in "010"

Status
Not open for further replies.

SethP

Technical User
Apr 21, 2002
19
0
0
US
I am trying to create a query that will find numbers starting with a certain location zone, and ending with a certain location zone.

Data-
925-266-161
912-274-010
925-176-010

I need the query to gather data that starts 903-913 and ends in 010, like 903-xxx-010 to 913-xxx-010. Then the query will only pull those items like the 912-274-010 listed above.
Any suggestions? I tried Between "903-999-010" And "913-999-010" but I received answers ending in '030'
 
Try:
Code:
SELECT * FROM MyTable WHERE (Location LIKE '???-???-010');


[tt]________________________________________________________________
[pc2]Roger
Life is a game of cards in which the deck contains only jokers.[/tt]
 
SethP,

I would take the first three and last three characters to create a prefix and suffix field then add the criteria that you need to get the range (Between) and the value for the last three characters.

The SQL will look something like this -

SELECT Table1.Zone, Left([Zone],3) AS Prefix, Right([ZOne],3) AS Suffix
FROM Table1
WHERE (((Left([Zone],3)) Between "903" And "912") AND ((Right([ZOne],3))="010"));


HTH,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top