I have a correct working T-SQL-script in this form
SELECT columnA
AS
'numbers'
FROM tableA
WHERE clause
This script gives me as one column, called numbers, of integers. I want to sum these.
Calling the above lines ‘script’ I tried the following setup
SELECT SUM(numbers)
FROM (
script
)
Reading select count(*) from select I supposed this to work, however, it does not. I keep getting “Incorrect syntax near.”
I do not know if it is important but that is here named columnA is itself maked by a SELECT statement.
You need an alias on the subquery:
So your full query will be: