Print Page | Close Window

Aphabetizing in SQL Query with "the"

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=6329
Printed Date: 30 March 2026 at 3:54am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Aphabetizing in SQL Query with "the"
Posted By: gr8indianbear
Subject: Aphabetizing in SQL Query with "the"
Date Posted: 10 October 2003 at 9:18pm
I want to run a query that will alphabetize a table according to the title of the article, but some of the titles have the word "The" and i dont want it to be alphebtized by "The" but by the word that follows. How do i do this? i imagine its something i have to write within the SQL Statement.



Replies:
Posted By: ljamal
Date Posted: 11 October 2003 at 2:31am
You will need remove the articles (A, An, The) from the front. I have done this in 2 different ways.

One is to have separate field of for the article (I use an int field with 1=A, 2=An, 3=The, 4=None).

The other is the library method of placing the article at the end with a preceded comma and space. With the second method, I use a VBscript function to strip off the articles from the end and place them at the beginning. You must also have a function to strip them off the beginning for storage in the database.

There is a third way to do it using CASE with SQL Server, but that is not availble with Access. If you use SQL Server, then check out the documentation for CASE.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net