The goal of the query here was simplified, but it represents a complex one that I want to select all users fields from the subquery plus computing a SUM. So, this is an example only.
I'm doing a subquery because of a problem with SUM duplicate rows. Like recommended to do with this answer: https://stackoverflow.com/a/7351991/255932
But the problem is that subquery also selects a column "rating" from the table ratings and I can't select all users fields unless describing all users columns on parent select.
SELECT id, name, x, y, z ..., SUM(rating)
FROM
   (SELECT users.*, ratings.rating
    FROM users
    INNER JOIN ratings ON
    users.id = ratings.user_id
   )
GROUP BY users.id
I would like to know if there is a way to replace (id, name, x, y, z, ...) with a simple (users.*).
 
     
     
    