If we're trying to get the max value between 3 columns in a row like this: Prolog transmodal asian 1 2 3
We'd want to get the value "3" If you wanted to get the max out of three values in a row, you might do something like this: SELECT MAX(prolog, transmodal, asian) FROM sometable I think that'd work. But then there's mention of row1 vs row2 vs row3.. So I guess I'm confused. In which case, if we're looking at: Name Value ---- ----- Prolog 1 Transmodal 2 Asian 3 Then you'd do something like this: SELECT Name, Max(Value) FROM sometable group by Name You can do this in PHP as well, but make the DB server do all the work. :) -TG > -----Original Message----- > From: Dennis Seavers [mailto:[EMAIL PROTECTED] > Sent: Friday, November 19, 2004 1:46 AM > To: Louie Miranda > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] getting the highest number in 3 db fields? > > > Try using the SQL aggregate function MAX() or the PHP function max() > > > > [Original Message] > > From: Louie Miranda <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Date: 11/18/2004 11:34:57 PM > > Subject: [PHP] getting the highest number in 3 db fields? > > > > I have a db field of 3. > > > > - prolog > > - transmodal > > - asian > > > > I wish to get the highest number of those three, in > different fields. > > > > Im thingking of.. > > > > if (row0 =< row1) ... > > > > how about row2? > > > > confused.. > > > > -- > > Louie Miranda > > http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php