Solved

select first alphabet from title

Posted on 2008-10-23
4
415 Views
Last Modified: 2010-08-05
Hello,
i have a field called "title" in my table, can you tell me the sql statement to select the row if the first alphabet of the title is "a"?

for example here are 3 rows:
jack is a good boy
jill is sillu
abby is naughty
kevin is lazy

If i do a search on "j" then both jack and jill should come back as results...
and lastly, how to do this if the first character is a number from 0-9?

Thanks!
0
Comment
Question by:scarab890
  • 2
4 Comments
 
LVL 19

Expert Comment

by:bevhost
ID: 22791727
select * from mytable where title like 'a%'
select * from mytable where title like 'j%'
select * from mytable where title like '0%'
0
 
LVL 27

Expert Comment

by:yodercm
ID: 22791734
SELECT * FROM Table WHERE SUBSTRING(title,1,1)='a'
0
 
LVL 19

Accepted Solution

by:
bevhost earned 250 total points
ID: 22791752
select * from mytable where title >= '0' and title <='9'

select * from mytable where title between 'f' and 'k'
0
 

Author Comment

by:scarab890
ID: 22892112
This was the most important to me:
select * from mytable where title >= '0' and title <='9'

thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now