A real easy way would be too. 

Make a field to store the first letter of the last name.

Grab the first letter, save it to that field, index the field
since you will be searching on it. 

Then 

SELECT fields
FROM Users
WHERE letter = 'A'

Voila, very quick and effecient. 

You can even just add this field and write a 
quick loop over the query to save everyones first letter name.

If the system gets very complex you may consider using SQL Server
Freetext or Verity collections (which are a royal pain) 

That is the 'easy' way..

Here is a little more advanced way (more fun too:) 


SELECT * 
FROM Users
WHERE Lower(Left(LName, 1)) = 'p'

Just make sure you index either your letter column or the last name
column this way your searches will be performed very quickly.

Jeremy Allen
elliptIQ Inc. 

>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Friday, January 26, 2001 11:14 AM
>To: CF-Talk
>Subject: Alphabetic List
>
>
>Hi,
>
>In Yahoo address book, they have this list for finding a particular
>person easily
>by the first letter of their last name:
>
>All - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - Lists
>
>Does anyone have any insights on how the algorithm of implementing this
>feature?
>
>For example, I have a user database, and I want to use this feature to
>find
>persons whose last name start with a particular letter.
>
>Thanks!
>
>Hong
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to