List:General Discussion« Previous MessageNext Message »
From:Michael Kruckenberg Date:May 12 2004 3:46pm
Subject:Re: ORDER BY Question
View as plain text  
Dirk Bremer (NISC) wrote:
> The following query produces the following results:
> 
> select job_coop as 'Job/Coop', count(*) as Count from queue group by
> job_coop;
> 
> +----------+-------+
> | Job/Coop | Count |
> +----------+-------+
> | B03013   |    19 |
> | B05044   |     9 |
> | B07037   |     6 |
> | B15037   |     4 |
> | B16032   |     6 |
> | B17026   |     6 |
> | B17056   |    18 |
> | B18032   |     5 |
> | B20009   |    31 |
> | B21012   |     1 |
> | B24026   |     8 |
> | B25001   |    42 |
> | B27043   |    10 |
> | B27047   |     8 |
> | B29064   |     6 |
> | B31004   |    61 |
> | B36035   |    60 |
> | B36529   |    54 |
> | B38023   |    38 |
> | B38034   |     7 |
> | B40020   |    30 |
> | D18032   |    31 |
> | D27047   |     2 |
> | D31004   |    59 |
> +----------+-------+
> 
> Is there a way to use the ORDER BY clause to order the results by the
> numeric value of the count(*), i.e. so that the results would be sorted by
> the result of the count(*)?

select job_coop as 'Job/Coop', count(*) as Count from queue group by 
job_coop order by Count;

Thread
ORDER BY QuestionDirk Bremer \(NISC\)12 May
  • Re: ORDER BY QuestionMichael Kruckenberg12 May
  • Re: ORDER BY Question(Johan Hook)12 May
  • Re: ORDER BY QuestionRhino12 May
  • Re: ORDER BY QuestionDirk Bremer \(NISC\)12 May
    • Re: ORDER BY Question(Johan Hook)13 May