Solved

select first alphabet from title

Posted on 2008-10-23
4
421 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: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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
simple shopping cart database structure 5 101
change database name 2 40
SELECT query on two levels (detail and summary) 13 64
MySQL stored procedure returning null values 4 25
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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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