RE: Re: I can't seem to get Max() to work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



can anybody advise if there is any command so that MAX can be found in the
data entered the columns.

i mean to say suppose i have three columns
col1 col2 col3 in a table
now the MAX value to find from col1, col2, col3.


with best wishes
balwant



-----Original Message-----
From: David Robley [mailto:robleyd@xxxxxxxxxxxxxx]
Sent: Thursday, October 28, 2004 10:54 AM
To: php-db@xxxxxxxxxxxxx
Subject:  Re: I can't seem to get Max() to work


On Thu, 28 Oct 2004 14:35, Chris Payne wrote:

> Hi there everyone,
>
>
>
> I can?t seem to get the below to work with PHP and MySQL:
>
>
>
> $sql = "SELECT MAX(FoodItemNumber) FROM menuitemsubs";
>
>
>
> What am I doing wrong?  I need the highest number from the column
> FoodItemNumber, but it doesn?t return anything unless I change the MAX()
> to a * and I don?t want that I need it to be the MAX() number as it isn?t
> an auto-increment field.

Works a treat for me; au_linkid is a smallint which is not autoincrement, nd
not indexed at all.

mysql> select max(au_linkid) from categ_link;
+----------------+
| max(au_linkid) |
+----------------+
|            540 |
+----------------+
1 row in set (0.03 sec)

FoodItemNumber is an integer type?

--
David Robley

I Have To Stop Now, My Fingers Are Getting Hoarse!

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux