Re: Select MAX(column1,column2)

2005-06-02 Thread mfatene
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

Re: Select MAX(column1,column2)

2005-06-01 Thread Scott Klarenbach
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

Re: Select MAX(column1,column2)

2005-05-27 Thread Scott Klarenbach
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

Re: Select MAX(column1,column2)

2005-05-27 Thread mfatene
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; > +--+--

Re: Select MAX(column1,column2)

2005-05-27 Thread mfatene
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 | +--+

Re: Select MAX(column1,column2)

2005-05-27 Thread Keith Ivey
[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

Re: Select MAX(column1,column2)

2005-05-27 Thread mfatene
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

Re: Select MAX(column1,column2)

2005-05-27 Thread Scott Klarenbach
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

RE: Select MAX(column1,column2)

2005-05-27 Thread Jay Blanchard
[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]

Re: Select MAX(column1,column2)

2005-05-27 Thread SGreen
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

Re: Select MAX(column1,column2)

2005-05-27 Thread Keith Ivey
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