just starting with mysql... had this table rating with this placement...
http://i.stack.imgur.开发者_JAVA技巧com/kExbh.jpg
i want to get the average value of rating on a specific question_id(example: question_id=1, therefore: (5+4+3)/3=average and question_id=2, therefore:(3+4)/2=average) and transfer the value of average to another table which is result...that would look like below...
http://i.stack.imgur.com/j1erd.jpg
any help will be greatly appreciated...^^
You can use this query:
INSERT INTO results (subject_id, question_id, average)
SELECT subject_id, question_id, AVG(rating)
FROM rating
GROUP BY subject_id, question_id
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论