Solved

select first alphabet from title

Posted on 2008-10-23
4
411 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
Comment Utility
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
Comment Utility
SELECT * FROM Table WHERE SUBSTRING(title,1,1)='a'
0
 
LVL 19

Accepted Solution

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

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

Author Comment

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

thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

10 Experts available now in Live!

Get 1:1 Help Now