Try :
select * from (select post_id,count(*) count_post from views group by post_id order by 2 desc) where rownum <=5;
More Related Contents:
- SELECT list is not in GROUP BY clause and contains nonaggregated column …. incompatible with sql_mode=only_full_group_by
- How to do the Recursive SELECT query in MySQL?
- MySQL foreign key constraints, cascade delete
- MySQL case sensitive query [duplicate]
- SQL Performance UNION vs OR
- Simulating MySQL’s ORDER BY FIELD() in Postgresql
- What does mysql error 1025 (HY000): Error on rename of ‘./foo’ (errorno: 150) mean?
- Using SQL to determine word count stats of a text field
- Equivalent of varchar(max) in MySQL?
- How to escape literal percent sign when NO_BACKSLASH_ESCAPES option is enabled?
- MySQL MONTHNAME() from numbers
- MySQL Order before Group by
- How to transpose mysql table rows into columns
- MySQL incorrect key file for tmp table when making multiple joins
- “193: %1 is not a valid Win32 application” bug with a new Rails Application
- Does the order of conditions in a WHERE clause affect MySQL performance?
- Difference between these two joining table approaches?
- Get total number of rows when using LIMIT? [duplicate]
- MySQL query, MAX() + GROUP BY
- Convert JSON array in MySQL to rows
- Table is specified twice, both as a target for ‘UPDATE’ and as a separate source for data in mysql
- MySQL export into outfile : CSV escaping chars
- Simple Random Samples from a MySQL Sql database
- MySQL Select minimum/maximum among two (or more) given values
- MySQL: Many tables or many databases?
- Select only last value using group by at mysql
- Query to count the number of tables I have in MySQL
- How to kill MySQL connections
- `MODIFY COLUMN` vs `CHANGE COLUMN`
- How to solve MySQL max_user_connections error