List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:July 30 2002 8:22pm
Subject:Re: getting the maximum value
View as plain text  
select name, amount from myTable order by amount desc limit 1;

destr0 wrote:

> 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?

removing duplicate recordswalt30 Jul
  • Re: removing duplicate recordsGerald Clark30 Jul
RE: removing duplicate recordsDavid Kramer30 Jul
  • Re: removing duplicate recordswalt31 Jul
    • Re: removing duplicate recordsVivian Wang31 Jul
    • RE: removing duplicate recordsGordon31 Jul
  • getting the maximum valuedestr031 Jul
  • Re: getting the maximum valueGerald Clark31 Jul
RE: removing duplicate recordsDavid Kramer31 Jul
RE: getting the maximum valueChris Kay31 Jul