Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6982817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:20:17+00:00 2026-05-27T18:20:17+00:00

I am what you would call a ‘noob’ at MySQL. I can insert/edit/select stuff,

  • 0

I am what you would call a ‘noob’ at MySQL. I can insert/edit/select stuff, but anything more advanced than that stumps me. I have two tables in my database:

Table ‘reviews’

id      int(11)
review  varchar(2500)
game    int(11)
user    int(11)
title   varchar(200)`

and Table ‘review_rating’

user    int(11)
review  int(11)     // Corresponds to `reviews.id`
like    tinyint(1)

Here is my question: Is it possible to use ORDER BY on the reviews table to order the result by the total number of review_ratings with ‘like’ = 1 (where ‘review’ = the id of the ‘reviews’ table) divided by the total number of review_ratings (where ‘review’ = the id of the ‘reviews’ table).

Example:

SELECT * 
FROM `reviews` 
WHERE `game` = ? 
ORDER BY (total number of review_ratings where review = reviews.id and like = 1 / 
         total number of review_ratings where review = reviews.id) 
LIMIT 0, 10
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:20:18+00:00Added an answer on May 27, 2026 at 6:20 pm
    SELECT  t.review,
            Score = CASE WHEN TotalReviews<> 0 THEN LikedReviews/TotalReviews ELSE NULL END
      FROM  (
                  SELECT    *,
                        (SELECT COUNT(*) FROM review_rating WHERE review = r.review) AS TotalReviews ,
                        (SELECT COUNT(*) FROM review_rating WHERE review = r.review AND like = 1) AS LikedReviews,
                  FROM  review r        
                 WHERE  game = ?
             )t
    ORDER BY t.review, Score
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would call myself an intermediate jQuery developer, but I'm confused about what this
I thought the GC would call Dispose eventually if your program did not but
I'm running Python 3.1 and you would call me an advanced novice :) My
I don't know if you would call it the canonical formulation, but to bind
I'm currently working on what I would call integration tests. I want to verify
I have a GUI program, which would call a cmd in this GUI program.
I'm trying to create a subclass of JButton or AbstractButton that would call specified
Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically
When would you call Java's thread.run() instead of thread.start() ?
How would you call the constructor of the following class in these three situations:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.