Re: order by what?
| From: | Eddie Drapkin | Date: | Thu, 11 Jun 2009 15:42:47 +0000 |
| Subject: | Re: order by what? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293943@lists.php.net to get a copy of this message | ||
On Thu, Jun 11, 2009 at 11:35 AM, PJ <af.gourmet@videotron.ca> wrote:
> Robin Vickery wrote:
> >
> >
> > 2009/6/11 PJ <af.gourmet@videotron.ca
> > <mailto:af.gourmet@videotron.ca>>
> >
> > How can order by be forced to order alphabetically and ignore accents
> > without stripping the accents for printout? This is a problem for
> both
> > caps & normal letters.
> >
> >
> > Depends on the database.
> >
> > If you're using mysql, the order is governed by the collation used. To
> > get the order you want, you need a case-insensitive and
> > accent-insensitive collation. Exactly which one you use will depend on
> > the character set that you're using, but if you're character set is
> > utf8, then the utf8_general_ci collation should work:
> >
> > SELECT fieldname FROM tablename ORDER BY fieldname COLLATE
> > utf8_general_ci;
> >
> > -robin
> Obviously there is another solution, albeit rather silly: re-enter all
> the fields in alphabetical order with corresponding id fields in
> numerical order... great, if you're not going to change the list and if
> it's quite short... not too clever, though is it?
>
> --
> Hervé Kempf: "Pour sauver la plančte, sortez du capitalisme."
> -------------------------------------------------------------
> Phil Jourdan --- pj@ptahhotep.com
> http://www.ptahhotep.com
> http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
PFFFFFT just run a cron job to re--order the table every two minutes.
Easily the best solution.