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]

Reply via email to