List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 6 2002 11:26pm
Subject:RE: mysql and order in a query
View as plain text  
At 18:28 +0200 4/6/02, Roger Baklund wrote:
>* Paul DuBois
>>  At 18:03 +0200 4/6/02, David yahoo wrote:
>>  > Is there any way to put a sort order different than the
>>  > alpahbetical order in string.
>>  >
>>  >A thing like that order "french","german" ....
>>
>>
>>  ORDER BY ELT(language,'english','german','french'),Linkname ASC
>
>Maybe you meant FIELD(language...?

Right.  Thanks.



>
>>From the manual:
>
>Changes in release 3.20.17
>--------------------------
>[...]
>    * The `ELT()' function is renamed to `FIELD()'.  The new `ELT()'
>      function returns a value based on an index: `FIELD()' is the
>      inverse of `ELT()' Example: `ELT(2,"A","B","C")' returns `"B"'.
>      `FIELD("B","A","B","C")' returns `2'.
>
>The language column is a string containing 'english', 'french' or 'german'.
>
>The order of the fields in the FIELD() should be the order of what you want
>as a result:  'french','german','english' will give you 'french' items
>first, 'english' items last. Beware that any item with a language not
>existing in the field list will get a zero value, and be sorted first.
>
>--
>Roger
>query

Thread
Help! Error in editing or creating columns...hedrickj5 Apr
  • Re: Help! Error in editing or creating columns...Victoria Reznichenko6 Apr
  • mysql and order in a queryDavid yahoo6 Apr
    • Re: mysql and order in a queryPaul DuBois6 Apr
      • RE: mysql and order in a queryRoger Baklund6 Apr
        • Re: mysql and order in a queryDavid yahoo6 Apr
        • RE: mysql and order in a queryPaul DuBois7 Apr