Solved

getting the first alphabet of a field

Posted on 2000-03-07
3
198 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:qader99
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
maxkir earned 25 total points
ID: 2590880
SELECT DISTINCT LEFT(col, 1) FROM $table;
0
 

Author Comment

by:qader99
ID: 2591093
Thankyou Maxkir

I got the desired results from the select statement you provided
0
 
LVL 2

Expert Comment

by:maxkir
ID: 2592105
Read Mysql docs more throughly ;-)
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

810 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