Jump to content

Sort database posts by amount of "likes".


Jirinex

Recommended Posts

Posted

Hello,

 

I assume sorting a database posts by the amount of "likes" is not possible, so could anyone maybe point me to an sql query I could use to get this info? I have in one post about 300 or so post and I need them sorted by their likes.

Thanks.

Posted

Something like that?

select type_id as post_id, count(id) as likes from core_reputation_index where type = 'pid' group by type_id order by likes desc limit 5;

1e172268a3afa5fa67a180cc7dfb4a0b.thumb.png.9721164bec3cb94330161dea52cc5de0.png

Posted

Thanks a lot, that looks close to what I need, but can I also match the post id to the user who made the reply?

Edit: I need this list for a specific article, not for all posts in the articles database.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...