列相加即可
注意Null不可加,先用ISNULL方法验证,设置默认值
SELECT ID,
Name,
Province,
City,
District,
ISNULL(row1, 0),
ISNULL(row2, 0),
ISNULL(row3, 0),
ISNULL(row4, 0),
ISNULL(row5, 0) + ISNULL(row6, 0) + ISNULL(row7, 0)
+ ISNULL(row8, 0) AS 'total'
FROM O WITH(NOLOCK)