我正在尝试在Stack* Data Explorer上编写一个关于“我输入了多少字”的查询,涉及到IT技术相关内容。修改现有的查询已经让我进展了一部分:
-- How much did I type?
DECLARE @UserId int = ##UserId##
select sum(len(Body)) AS 'Posts' from posts where owneruserid = @UserId,
select sum(len(Text)) AS 'Comments' from comments where userid = @UserId,
(select sum(len(Body)) from posts where owneruserid = @UserId +
select sum(len(Text)) from comments where userid = @UserId) AS 'Total'
我希望能够得到一个包含三列和一行的表格,就像这样:
Posts Comments Total
1234 5678 6912
但是有一些语法问题,导致我出现以下错误:
错误:附近的逗号语法不正确。 附近的逗号语法不正确。选择关键字附近的语法不正确。 附近的括号语法不正确。
这个应该怎么写才是正确的语法?