SELECT name FROM myTable order by amount DESC limit 1
Would show all records sort them by amount desc and limit it to 1 record This help... --------------------------------------------------------------------------- Chris Kay Technical Support - Techex Communications Website: www.techex.com.au Email: [EMAIL PROTECTED] Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 Platinum Channel Partner of the Year - Request DSL - Broadband for Business --------------------------------------------------------------------------- > -----Original Message----- > From: destr0 [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 31 July 2002 6:11 AM > Cc: [EMAIL PROTECTED] > Subject: getting the maximum value > > > If I hav a table "myTable": > > id name amount > 1 john 2 > 2 joel 15 > > I want to get the name of the person with the largest amount.. but I > can't seem to come up with a good query for this. > > I tried SELECT name FROM myTable WHERE amount = MAX(amount); > > I get group by errors... > > can anyone suggest a better method for this? > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php