I have been struggling with the following problem for a long time.
I have an experience table like this
id | uid | positive | negative
uid - gains the experience 
positive - is the experience positive?
negative - is the experience negative?
The user table look like this
id | username | password
But how can I count the net experience for a user? How can I determine if the net experience is positive or negative with a query?
SELECT uid, SUM(positive - negative) AS NetExp
FROM experience 
GROUP BY uid
This shows you the net experience per user. What do you mean with collect it?
It would be better to have experience as a single column and add to it and subtract from it as necessary, rather than two columns to store one number. A query that would work in your case now though would be:
SELECT `uid`, (`positive`-`negative`) as exp FROM `experience`
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论