?
Solved

select first alphabet from title

Posted on 2008-10-23
4
Medium Priority
?
427 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
[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 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:Cornelia Yoder
ID: 22791734
SELECT * FROM Table WHERE SUBSTRING(title,1,1)='a'
0
 
LVL 19

Accepted Solution

by:
bevhost earned 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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