Jump to content

[SOLVED] Selecting overall top 5


uramagget

Recommended Posts

I want to make a top 5 for a little mods script I downloaded, but in order to be an overall part of the top 5, a mod has to be high in each:

 

# of Downloadeds

# of Installs Marked

# of Views

# of Comments

 

 

Though the Math and performing the SQL query is just complicated. I do not know if there is further information to provide, but if there is, please tell me.

Link to comment
https://forums.phpfreaks.com/topic/86949-solved-selecting-overall-top-5/
Share on other sites

You may also wish to multiply by a weighting factor. For example, you may consider that views are less important than the other factors. The query would be something like:

 

SELECT (downloads+installs+views*0.5+comments) as total FROM table ORDER BY total DESC

Question 1.) No.

 

Question 2.) You'll need to join the tables. Lets say you have a field called id in both, which the join can be performed on. Lets also say downloads and installs are in table1 and views and comments are in table2:

 

SELECT (table1.downloads+table1.installs+table2.views*0.5+table2.comments) as total, table1.id as id FROM table1,table2 WHERE table1.id=table2.id ORDER BY total DESC

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.