I have a table similar to the one below:
1 3 1 2 2 1 3 -2 3 23 7 16 4 5 1 4 5 7 5 2 6 2 2 0 7 9 1 8
How do i Come up with the Vote_Total?
尝试这个:
update mytable set vote_total = vote_up - vote_down
If you already have the column,and want to update @ssamuel's answer will guide you. If you do not have the Vote_Down column, and wanted to select it as a column in query. This would be the select query :
SELECT ID , Vote_Up , Vote_Down , ( Vote_Up - Vote_Down)
as Vote_Total from myVotesTable
Assumed : Vote_Up and Vote_Down are integer or varchar fields with numeric values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.