Try this:

select distinct substr(companyname,1,1) as firstletter
from companyTable
order by firstletter

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, August 17, 2002 11:20 PM
> To: CF-Talk
> Subject: Distinct Alpha
> 
> 
> I've got a home-grown contact manager component I've built 
> and want to 
> enhance and currently display a clickable table of all letters in the 
> alphabet that brings up all the companies that start with 
> that letter...
> 
> What I want to do is to do a Query on the database and only 
> have a letter 
> from the alphabet appear in the table when there are companies in the 
> database that start with that letter... so if there are no 
> companies that 
> start with the letter J then I don't want it to be F G H I J 
> K L - Instead 
> I want it to be F G H I K L
> 
> I know how to do a distinct on the COMPANY field, but I don't 
> know how to 
> do a distinct on the first letter in the COMPANY field...
> 
> HELP!
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to