HY。如果我将存储在字段中的所有值相加,我该如何设置查询? 现在我有了这个问题:
"SELECT views FROM visitors WHERE visited_user = '123'"
我存储了这些记录:
id visitor visited_user views
-------------------------------------
1 555 123 15
2 666 123 23
3 777 123 45
-------------------------------------
total 83
答案 0 :(得分:0)
SELECT SUM(views)
FROM visitors
WHERE visited_user = '123'
答案 1 :(得分:0)
SELECT SUM(views) FROM visitors WHERE visited_user = '123'