Jump to content

Sorting help


moon 111

Recommended Posts

I have two relevent tables: sites and rating. Rating has these rows: sid (site id), uid (userid) and rating. When someone votes on a website it adds to rating the sid of the site their uid and their rating. What I need to do is sort the site table by rating. How can I do that?

Link to comment
Share on other sites

I kind've need the help quickly....

Umm, you're getting free help from a public community, which members donate their free time to help.

 

Also in order to get you a faster reply would help if you posted your current query and posting your question within the correct board. PHP help is for PHP. Yours is related to MySQL (I presume) so I'll move this tread.

Link to comment
Share on other sites

I have a table sites that has the cols id, title, description, uid. I also have a table rating with the rows sid, uid, rating. sid reffers to the site. Now I want to sort 'sites' by the average of all of the ratings reffering to that site. This is a want I would do if I could (obviously not legal:

SELECT * FROM sites ORDER BY AVG(SELECT rating FROM rating WHERE sid = '".$sid."') DESC

.

 

Clear?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.