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

Search a database for a field that begins with . . . .

Status
Not open for further replies.

youthman

Programmer
Apr 28, 2004
49
US
Good morning, and a VERY happy New Year to ALL!

I don't know if this is a question more suitable for the SQL forum, but I figured I would try here first.

I want to search a field in an SQL database for all the rows that begin with a particular leter! For example, if the following is the rows in a column . . .

alpha
adam
adrian
betta
blue
bat

. . . and the search is "a," I only want alpha, adam, and adrian to be returned. If the search is "b," I want betta, blue, and bat.

Any help? Thanks!

The Youthman
 

select * from
(table_name) where
(field_name) like 'a%' ['b%' ...]

Check up the documentation..



 
Thank you SO MUCH! I KNEW there was an easy way, I just couldn't think of it! I have never used LIKE, but I was taught what it did. I just forgot! :) Thanks again!

The Youthman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top