I tried a lot but can't find what is wrong with this query, It gave me this error:
Incorrect syntax near ')'.
string query = "SELECT SUM(See) AS [All]
, (
SELECT TOP 1 See
FROM StateSite
WHERE StatDate = @StatDate
) AS [Now]
, (
SELECT TOP 1 See
FROM StateSite
WHERE StatDate = @Yesterday
) AS [Last]
, (
SELECT SUM(See)
FROM (
SELECT TOP 7 *
FROM StateSite
ORDER BY id DESC
)
) AS [week]
FROM StateSite";
also that works properly with access database but not by sql server.