devxlogo

SQL order by count

SQL order by count

Question:
I need to know how to order by the count of the selected field. For example:

Select xxx count(xxx)from prod-tableorder by xxx
I'd like to order/rank field xxx highest to lowest.

Answer:
You want to write:

select xxx,count(*)from prod-tablegroup by xxxorder by count(*)

devx-admin

Share the Post: