Your schema(I guessed because you failed to provide one)
CREATE TABLE bd_comments
(
commentid int ,
comment varchar(10),
author_id int
);
CREATE TABLE commentrate
(
comment_id int ,
rating int,
author_id int
);
INSERT INTO bd_comments
VALUES
(1, "comment 1", 100),
(2, "comment 2", 200),
(3, "comment 3", 300);
INSERT INTO commentrate
VALUES
(1, 3.5, 100),
(2, 4, 100),
(3, 5, 100),
(1, 2.5, 200),
(2, 1, 200);
Here is the query
SELECT cr.comment_id, floor(avg(cr.rating)) rating,c.comment, c.author_id
FROM commentrate cr, bd_comments c
WHERE cr.comment_id = c.commentid
GROUP BY cr.comment_id
Output
| COMMENT_ID | RATING | COMMENT | AUTHOR_ID |
|------------|--------|-----------|-----------|
| 1 | 3 | comment 1 | 100 |
| 2 | 2 | comment 2 | 200 |
| 3 | 5 | comment 3 | 300 |