Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sort by COUNT() - MYSQL

Posted on 2009-07-14
4
Medium Priority
?
451 Views
Last Modified: 2012-05-07
Hi, I have the following mysql query;

SELECT idea_id, COUNT(vote_id) FROM int_votes GROUP BY idea_id ORDER BY COUNT(vote_id) DESC

I want to sort the results by the COUNT, but when I try the above it says 'invalid use of group'.

Can anyone tell me where I'm going wrong?
0
Comment
Question by:SheppardDigital
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
Mushq earned 2000 total points
ID: 24847762
0
 
LVL 14

Expert Comment

by:flob9
ID: 24847775
Your query seems fine to me
0
 

Author Closing Comment

by:SheppardDigital
ID: 31603185
I changed my query to
SELECT idea_id, COUNT(vote_id) as count FROM int_votes GROUP BY idea_id ORDER BY count DESC
0
 
LVL 14

Expert Comment

by:flob9
ID: 24847807
The first version was working on mysql 5 ... good point mushq :)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question