I'm trying to write how much did I type? request for Stack * Data Explorer .
Modification of an existing request led me like this:
DECLARE @UserId int =
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'
I expect three columns and one row, something like this:
Posts Comments Total
1234 5678 6912
But there is a syntax issue due to which I get:
Error: Incorrect syntax next to ','. Invalid syntax next to ','. Incorrect syntax next to the select keyword. Invalid syntax next to ')'.
What is the correct syntax for this?
source
share