Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Aphabetizing in SQL Query with
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Aphabetizing in SQL Query with "the"

 Post Reply Post Reply
Author
gr8indianbear View Drop Down
Groupie
Groupie


Joined: 07 November 2002
Location: United States
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote gr8indianbear Quote  Post ReplyReply Direct Link To This Post Topic: Aphabetizing in SQL Query with "the"
    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.
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.