I forgot :

10, 12, 8 is not a row !!!

Mathias

Selon [EMAIL PROTECTED]:

> Hi Keith,
> yes concat makes an associative lost for max.
> But if we split the desc on all the columns, it works :
>
> mysql> select * from numbers
>     -> order by a desc,b desc,c desc
>     -> limit 1;
> +------+------+------+
> | a    | b    | c    |
> +------+------+------+
> |   10 |    2 |    3 |
> +------+------+------+
> 1 row in set (0.00 sec)
>
> it's a real desc ordering.
>
> Thanks
>
> Mathias
>
>
> Selon Keith Ivey <[EMAIL PROTECTED]>:
>
> > [EMAIL PROTECTED] wrote:
> > > Hi all,
> > > what is max ? it's the first row when we sort data in descending order.
> > >
> > > so
> > >
> > > select col1,col2,col3,col4 ... from table
> > > order by concat(col1,col2,col3,col4 ... ) desc
> > > LIMIt 1;
> > >
> > > should be silar to what is needed. I say should :o)
> >
> > That would only work if the greatest values for col2, col3, col4, etc., all
> > occurred in the same row with the greatest value for col1, and if all the
> > values
> > for col1 had the same number of digits (and the same for col2, col3, etc.).
> >
> > Consider this table:
> >
> >     10  2  3
> >      5  4  8
> >      1 12  7
> >
> > Your query would give 5, 4, 8 (because "548" as a string is greater than
> > "1023"
> > or "1127"), but he wants 10, 12, 8.
> >
> > --
> > Keith Ivey <[EMAIL PROTECTED]>
> > Smokefree DC
> > http://www.smokefreedc.org
> > Washington, DC
> >
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to