我是新手,我需要帮助 - 我需要根据ID在4个不同的表上进行SUM。
例如: table1.points table2.points table3.points table4.points user.userID
作为分数
我需要根据userID计算四个表中的所有点
任何帮助将不胜感激
答案 0 :(得分:0)
yon可以使用此代码对所有点进行求和
select
sum(a.point)
from
(select sum(point) as point from table1 where userid =1
union all
select sum(point) as point from table2 where userid =1
union all
select sum(point) as point from table3 where userid =1
) a