Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
This is a query-of-query in ColdFusion and MSAccess This works ok <cfquery name="session.getAlpha" dbtype="query"> select distinct signerName from session.getSigs </cfquery>Instead, I would like to select just the "first letter" of signerName inalphabetical order: <cfquery name="session.getAlpha" dbtype="query"> select distinct substring(signerName,1,1) as alpha from session.getSigs orderby alpha </cfquery>and it fails. This is giving me a rough time, im just not making the queryright ... Any help much appreciated!
snSQL
Master Smack Fu Yak Hacker
1837 Posts
Posted - 2006-10-11 : 16:08:58
Try
<cfquery name="session.getAlpha" dbtype="query">select distinct substring(signerName,1,1) as alphafrom session.getSigsorder by substring(signerName,1,1)</cfquery>
or
<cfquery name="session.getAlpha" dbtype="query">select distinct substring(signerName,1,1) as alphafrom session.getSigsorder by 1</cfquery>
jsmith8858
Dr. Cross Join
7423 Posts
Posted - 2006-10-11 : 16:37:47
or, since this is Access:select distinct mid(signerName,1,1) as alphafrom session.getSigsorder by mid(signerName,1,1)or better yet:select distinct left(signerName,1) as alphafrom session.getSigsorder by left(signerName,1)- Jeff