Re:Subject: Finding the highest number in a column?
| From: | Neil Smith [MVP, Digital media] | Date: | Thu, 28 Oct 2004 11:42:50 +0000 |
| Subject: | Re:Subject: Finding the highest number in a column? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37064@lists.php.net to get a copy of this message | ||
Surely some monday morning light headedness Chris !
SELECT MAX(column_name) AS max_number FROM table
Make sure the column's indexed if you do it often !
Cheers - Neil
At 03:32 28/10/2004 +0000, you wrote:
Message-Id: <200410280332.i9S3WolM018344@ms-smtp-01.tampabay.rr.com> From: "Chris Payne" <cjp@planetoxygene.com> To: <php-db@lists.php.net> Date: Wed, 27 Oct 2004 23:33:02 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative;======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.boundary="----=_NextPart_000_0000_01C4BC7D.4D8C22E0"Subject: Finding the highest number in a column? Hi there everyone, I am working with a very complex system where not all numbers are assigned 1, 2, 3 etc so there could be a row with the number 1 and then the next row could be 40 and so on Is there a way with PHP and MySQL to find out what the highest number is in a particular column easily when the numbers are auto-incremented so arent necessarily one after the other? I would really appreciate any help on this as its really bugging me. Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 10/25/2004