In all versions of MySQL, simply alias the aggregate in the SELECT list, and order by the alias:
SELECT COUNT(id) AS theCount, `Tag` from `images-tags`
GROUP BY `Tag`
ORDER BY theCount DESC
LIMIT 20
More Related Contents:
- MySQL: Invalid use of group function
- get first occurrence of last changed value of a column [closed]
- MySQL – Rows to Columns
- ROW_NUMBER() in MySQL
- multiple query same table but in different columns mysql
- How can I make SQL case sensitive string comparison on MySQL?
- How can I temporarily disable a foreign key constraint in MySQL?
- How to do a batch insert in MySQL
- Count the occurrences of DISTINCT values
- MySQL offset infinite rows
- Ordering by the order of values in a SQL IN() clause
- Creating a “Numbers Table” in MySQL
- SQL Selecting from two Tables with inner join and limit [duplicate]
- MySQL Group by SUM
- In SQL, how to select the top 2 rows for each group
- Mysql query to dynamically convert rows to columns on the basis of two columns
- mysql trigger stored trigger is already used by statement which invoked stored trigger
- How to skip certain database tables with mysqldump?
- MySQL error 1241: Operand should contain 1 column(s)
- How to set a MySQL row to READ-ONLY?
- How to create dummy variable columns for thousands of categories in Google BigQuery?
- Mysql: Order by like?
- Most efficient way to store IP Address in MySQL [duplicate]
- Getting first day of the week in MySql using Week No
- SQL date format convert? [dd.mm.yy to YYYY-MM-DD]
- MySQL OPTIMIZE all tables?
- Strip last two characters of a column in MySQL
- What happens when I exhaust a bigint generated key? How to handle it?
- is there a length limit to group_concat or another reason why it would not work on a text field
- Deleting a row based on the max value