Getting a Single count with union all
Hi,
Would you please tell me if it is possible to get only one count when using a union all like :-
select count(value_x) from table_a
Where name='BOB'
union all
select count(value_x) from table_b;
Where name='Chris'
Here both the count will return the same value
If I use the below query:-
select cnt
from (select count(value_x) cnt from table_a
UNION ALL
select count(value_x) from table_b
)
I am getting the values for the count (cnt) like 1,2,3,4,5,6,7,8,9,10 instead of
cnt
---
10
But the no. of rows are correct. How to change this?
Thanks.