Re: getting only the largest or smallest values in a select statement
| From: | Ajit Kolhatkar | Date: | Mon, 09 Oct 2000 12:31:49 +0000 |
| Subject: | Re: getting only the largest or smallest values in a select statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19179@lists.php.net to get a copy of this message | ||
select max(amount) from purchases
From: Dave Gardner <dgardner@exactax.com>
To: mysql@lists.mysql.com, php-general@lists.php.net
Subject: getting only the largest or smallest values in a select statement
Date: Fri, 06 Oct 2000 16:06:53 -0700
How can I get the largest (or smallest) value of a column in multiple
records, culled from a select statement? Let's say I did a 'select id,
amount from purchases' and got the following:
id amount
-- -------
1 488
2 1256
3 188
4 97
5 166
Is it possible to modify the query itself to select only the largest or
smallest value in 'amount' as displayed here? Or is there something I need
to do in PHP to figure that out?
--
---------------------------------------------------------------------
Please check "http://www.mysql.com/documentation/manual.php" before
posting. To request this thread, e-mail mysql-thread52712@lists.mysql.com
To unsubscribe, send a message to:
<mysql-unsubscribe-ajit_kolhatkar=hotmail.com@lists.mysql.com>
If you have a broken mail client that cannot send a message to
the above address (Microsoft Outlook), you can use:
http://lists.mysql.com/php/unsubscribe.php
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at http://profiles.msn.com.