getting the first alphabet of a field

I want to basically develop an alphabetical search engine so that  if a user Clicks on 'A'  all the titles whose name starts with A are displayed, and likewise for all the other alphabets. But the problem is that some titles begins with Numbers (for eg. 123ofcricket) and some even with special characters such as 'alpha', 'beta' and the list is very long. One more requirement is that suppose no title begins with 'X' than X should not be displayed in the search list.

I am thinking of runing a select statement with a distinct clause to retreive all the first letters of title from the table, but I could not create the SQL query.

I am using a MySql database with Php as the scripting language.

Can anybody please help or suggest any other suitable method.
Kindly help with example.

Thanks
Qader
qader99Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
maxkirConnect With a Mentor Commented:
SELECT DISTINCT LEFT(col, 1) FROM $table;
0
 
qader99Author Commented:
Thankyou Maxkir

I got the desired results from the select statement you provided
0
 
maxkirCommented:
Read Mysql docs more throughly ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.