The outer brackets are wrong, remove them.
And it don't make much sense to use a sub query here, the inner query returns the same as the outer with the sub query =>
select sum(total)
from table_1
where id =2
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello there?
I have a Query which has multiple sub Queries, but there is a problem using a sub query where i am using from clause like below:
(select sum(total) from (select sum(total) from table_1 where id =2) as tbltemp)).
How can i use above query in sub queries, it is returning syntax error.
Please guide!
Thanks in advance.
The outer brackets are wrong, remove them.
And it don't make much sense to use a sub query here, the inner query returns the same as the outer with the sub query =>
select sum(total)
from table_1
where id =2
The column in the table expression must be aliased.Please refer to:
(select sum(total) from (select sum(total) total from table_1 where id =2) tbltemp)
The above select statement adds parentheses. Considering that you publish in this format, it may be a partial subquery. If it is a single statement, parentheses are not required:
select sum(total) from (select sum(total) total from table_1 where id =2) tbltemp
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.