| 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? > >
| Thread | ||
|---|---|---|
| • removing duplicate records | walt | 30 Jul |
| • Re: removing duplicate records | Gerald Clark | 30 Jul |
| • RE: removing duplicate records | David Kramer | 30 Jul |
| • Re: removing duplicate records | walt | 31 Jul |
| • Re: removing duplicate records | Vivian Wang | 31 Jul |
| • RE: removing duplicate records | Gordon | 31 Jul |
| • getting the maximum value | destr0 | 31 Jul |
| • Re: getting the maximum value | Gerald Clark | 31 Jul |
| • RE: removing duplicate records | David Kramer | 31 Jul |
| • RE: getting the maximum value | Chris Kay | 31 Jul |
