Solved

getting the first alphabet of a field

Posted on 2000-03-07
3
204 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

830 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