Re: I can't seem to get Max() to work
| From: | David Robley | Date: | Thu, 28 Oct 2004 05:24:23 +0000 |
| Subject: | Re: I can't seem to get Max() to work | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37061@lists.php.net to get a copy of this message | ||
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!