List:General Discussion« Previous MessageNext Message »
From:Dodger Date:July 25 2001 12:52pm
Subject:Re: Sorting w/ leading articles ignored
View as plain text  
In PHP specifically, no clue.

Using Perl, something like so (and this assumes a 1:1 mapping on
titles/ids):

my $get_art_list = $sql->prepare(<<"eosql");
SELECT title, id
  FROM table
eosql
$get_art_list->execute;

my %articles;
while (my $art = $get_art_list->fetchrow_hashref) {
    $articles{$art->{'title'}} = $articles->{$art->{'id'};}

my @ordered = map {$articles{$_}} sort map
{/^((a)|(an)|(the))\s+(.*)/?$3:$_} keys %articles;

# you now have @ordered, which has key ids in order the way you want them.

Dodger
----- Original Message -----
From: "Bin Zhang" <bzhang@stripped>
To: "Msql-Mysql-Modules" <msql-mysql-modules@stripped>; "Mysql"
<mysql@stripped>
Sent: Wednesday, July 25, 2001 5:20 AM
Subject: Sorting w/ leading articles ignored


> Can this be done?  What I want is to generate a list of journal sorted by
> the titles, ignoring the leading articles (the, a, an, etc.).  If there is
> no SQL statement for this, How could I do this w/ DBI or PHP?  I am using
> mysql 3.23.40 on  Solaris 7. Thanks for any advise.
>
> Bin
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail
msql-mysql-modules-thread1334@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@stripped instead.
>
>

Thread
Start up problemsRichard Reina2 Apr
  • Re: Start up problemsSasha Pachev2 Apr
  • Re: Sorting w/ leading articles ignoredDodger25 Jul
  • Re: Sorting w/ leading articles ignoredStefan Hinz25 Jul