Link to home
Start Free TrialLog in
Avatar of scarab890
scarab890

asked on

select first alphabet from title

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!
Avatar of David Beveridge
David Beveridge
Flag of Australia image

select * from mytable where title like 'a%'
select * from mytable where title like 'j%'
select * from mytable where title like '0%'
SELECT * FROM Table WHERE SUBSTRING(title,1,1)='a'
ASKER CERTIFIED SOLUTION
Avatar of David Beveridge
David Beveridge
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scarab890
scarab890

ASKER

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

thanks!