| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Paul DuBois | Date: | February 1 2002 4:19pm |
| Subject: | Re: How do I select something distinct ordered by most frequent? (e.g. top 10) | ||
| View as plain text | |||
At 15:56 +0000 2/1/02, SED wrote: >Hi, > >I'm trying to make a query where I select something distinct ordered by >most frequent? > >I found below example from the manual but I can not figure out how I >should order them by most frequent - do you know how? > > SELECT DISTINCT owner FROM pet Don't use distinct in that case. Count them and order by the descending counts. SELECT owner, COUNT(owner) AS frequency FROM pet ORDER BY frequency DESC; > >Regards, >SED
| Thread | ||
|---|---|---|
| • MyODBC | Mike Nelson | 26 Jan |
| • Re: MyODBC | Sinisa Milivojevic | 26 Jan |
| • Data Types for TEXT, BINARY? | Paul Reilly | 26 Jan |
| • Re: Data Types for TEXT, BINARY? | Jeremy Zawodny | 26 Jan |
| • RE: MyODBC | Venu | 26 Jan |
| • Re: MyODBC | D'Arcy Rittich | 1 Feb |
| • Re: MyODBC | Sinisa Milivojevic | 1 Feb |
| • How do I select something distinct ordered by most frequent? (e.g. top 10) | SED | 1 Feb |
| • Re: How do I select something distinct ordered by most frequent?(e.g. top 10) | Paul DuBois | 1 Feb |
| • Re: How do I select something distinct ordered by most frequent?(e.g. top 10) | Paul DuBois | 1 Feb |
| • RE: MyODBC | Venu | 1 Feb |
