MySQL Select Statement - Two Tables, Sort One Table by Count of Other Table

Posted by Robert Boka on Stack Overflow See other posts from Stack Overflow or by Robert Boka
Published on 2009-11-12T03:15:32Z Indexed on 2010/03/22 9:31 UTC
Read the original article Hit count: 247

Filed under:
|
|
|

So I have built a voting system for a custom post system i wrote.

I want to be able to sort by "most voted", "Most liked", etc.

I have two tables.

Entry: ID, Title, Post

Vote: ID, EntryID, Result

I want to be able to query the vote table for each entry and see how many vote's there are, and then sort the entry's by how many vote's each table had. I have messed around with joins, etc. and cannot seem to figure it out. Any suggestions?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql