0

Is it possible to have the sum of next two queries in one query?

select COUNT(1) 
from BinaryAssets.BinaryAssetsTags
where TagId = 1731

select COUNT(1) 
from Planning.ScheduleTag
where TagId = 1731

Result from first query is 3 for example, from the second 2. I want one query that gives me back 5.

2 Answers 2

6
SELECT 
(select COUNT(1) from BinaryAssets.BinaryAssetsTags where TagId = 1731) 
+ 
(select COUNT(1) from Planning.ScheduleTag where TagId = 1731) 
AS total_sum
Sign up to request clarification or add additional context in comments.

Comments

2

You can follow this syntax ,

select (select Count(1) from a)+(select Count(1) from b) as 'Total Count'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.