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) Mathias Selon Scott Klarenbach <[EMAIL PROTECTED]>: > Thanks Keith. It didn't quite work as expected, but it helps me a lot > none the less. > > The Documentation says it returns the max value, so > select greatest(1, 2, 3, 4) will return 4. > > But, across multiple column names, it returns all the values in one > column, not just the greatest one...so > > select greatest(fieldone, fieldtwo, fieldthree, fieldfour) from table > returns > > 10 > 12 > 14 > 29 > 6 > 3 > 444 > > etc...from all 4 of those fields. > > So, by going Select MAX(GREATEST(fieldone, fieldtwo, fieldthree)) I > can accomplish exactly what I've been banging my head against a wall > for...thanks. > > On 5/27/05, Keith Ivey <[EMAIL PROTECTED]> wrote: > > Scott Klarenbach wrote: > > > > > Can I select the maximum value across multiple columns? > > > > You want the GREATEST() function: > > > > http://dev.mysql.com/doc/mysql/en/comparison-operators.html > > > > -- > > 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] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]