> > select job_coop as 'Job/Coop', count(*) as Count from queue group by
> > job_coop order by Count;
>
>
> The other alternative is to omit the 'as Count' and use this query:
>
> select job_coop as 'Job/Coop', count(*)
> from queue
> group by job_coop
> order by 2;
>
> where the '2' in the 'order by' is the number of the column you are
sorting.
> (The count(*) expression is the second column of the result set so you
> replace it with a 2). This saves you from having to use an 'As' expression
> for 'count(*)' although it makes the query less clear too. (It won't be
> apparent to some people what the effect of the '2' in the 'order by' is.)
>
> Rhino

Thanks for all of the suggestions, the 'order by count' worked like a charm.
Concerning Rhino's suggestion quoted above, it this method of using numbers
to represent the columns documented anywhere?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to