Solved

select first alphabet from title

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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 …
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
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…

828 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