Have an account? Sign in
Login  Register  Facebook
how to select from database a text orgonized Alphabetically
Hi!
please how can i make a selecting from my database orgonased by order of Alphabet
exemple
on the top of my website i wanna put
A B C E D ....
every letter take all the names in the database wish start by the letter clicked
please !
Started: September 18, 2011 Latest Activity: September 18, 2011 php sql
3 Answers
its very easy just use left():
\"select * from `films2` where left(title, 1) = \'%a\'\"
This assumes that you haven\'t foolishly used a case sensitive collation as well. In case you were being silly and did that well:
\"select * from `films2` where left(lower(title), 1) = \'%a\'\"

Posted: MacOS
In: September 18, 2011

I believe you can use a LIKE statement to achieve this.
SELECT * FROM `table` WHERE `title` LIKE 'a%'
That will select anything where the title starts with an 'a', the % allows for anything after that. I'm not sure if this is case-sensitive or not (I don't believe it is), can someone confirm either way?

Posted: Go
In: September 18, 2011

i think you can order the films by title
just use
select from `films2` order by title

Posted: xtremex
In: September 18, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer