On 8 Apr 2002, at 13:52, Bernd Menzel wrote:

> I want to order a result with ignore the first word when it begins with a _.
> Begin the first word with a _ use the next word.
> 
> Can I do it with SQL?
> 
> Table example:
> _The Rock
> Scary Movie
> X-Files
> 
> With order I want the output
> Scary Movie
> _The Rock
> X-Files

I thought you wanted to ignore the "The".

Since you're going to have to process the titles before display 
anyway, to remove the _, why not move the "The" to the end for 
storage, separating it with some character that never occurs in a 
title: "Rock|The"?  Then the sort should work correctly.

A more flexible solution would be to introduce a new column to sort 
by, which would contain the title with initial "The"/"A"/"An" 
stripped off and maybe all spaces/punctuation removed as well -- or 
do you want "X-Files" to be before "Xanadu"?

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to