这个Data Explorer SQL查询有什么问题?

Laz*_*zer 5 sql database syntax-error

我正在写一个我输入了多少?查询Stack*Data Explorer.

修改现有的查询让我走得很远:

-- 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'
Run Code Online (Sandbox Code Playgroud)

我期待三列一行,如下所示:

Posts    Comments    Total
1234     5678        6912
Run Code Online (Sandbox Code Playgroud)

但是有一些语法问题,由此得到:

错误:','附近的语法不正确.','附近的语法不正确.关键字"select"附近的语法不正确.')'附近的语法不正确.

这个的正确语法是什么?

Aar*_*run 3

这是一个有效的查询:

DECLARE @UserId int;
set @UserID = 4;  

Select *, (Posts+Comments) as Total
FROM
  (select sum(len(Body)) AS Posts    FROM posts    where owneruserid = @UserId ) p,
  (select sum(len(Text)) AS Comments FROM comments where userid      = @UserId ) c
Run Code Online (Sandbox Code Playgroud)