Hi Scott,
you may be int his case : http://bugs.php.net/bug.php?id=32882
can't reproduce it because of env lack
Mathias
Selon Scott Klarenbach <[EMAIL PROTECTED]>:
> You guys have been so helpful with this, I'm hoping that I can ask for
> one more favor...
>
> The reason I needed the greatest(m
You guys have been so helpful with this, I'm hoping that I can ask for
one more favor...
The reason I needed the greatest(max()) functionality, was to run the
following query...I can make it work from the command line, but
everytime I run it from PHP, the MySQL service shuts down, and needs
to be
select greatest(max(col1), max(col2), max(col3), max(col4)) from table
works the best, as Keith pointed toward initially. Remember, I forgot
to mention that I wanted the greatest for the whole table, not just
for each rowso, 10, 12, 8 is not what I wanted...out of
10 2 3
5 4 8
1 12 7
i
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;
> +--+--
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 |
+--+
[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 greate
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
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 g
[snip]
Can I select the maximum value across multiple columns?
ie, I'd like to select the highest value of buyCost AND sellCost in a
table...where buy and sell are two different columns in the same
table.
i actually have 4 comparisons to run, and don't want to have to
execute 4 queries.
[/snip]
Scott Klarenbach <[EMAIL PROTECTED]> wrote on 05/26/2005 04:25:22
PM:
> Can I select the maximum value across multiple columns?
>
> ie, I'd like to select the highest value of buyCost AND sellCost in a
> table...where buy and sell are two different columns in the same
> table.
>
> i actually ha
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 Lis
11 matches
Mail list logo