如何将不同的计数查询放在一个 table 结果中
How to put different count queries in one table result
如果我有这三个计数查询,例如:
第一个:
Select count(*) as red
from A
result = 10
第二个:
Select count(*) as yellow
from B
result = 15
第三名:
Select count (*) as green
from C
result = 20
如何使用 oracle 使结果像
red yellow green
10 15 20
select (Select count(*) from a) red, (Select count(*) from b) yellow, (Select count(*) from b) green from dual;
像这样:
select * from (Select count(*) as red from A) as count_A
,(Select count(*) as yellow from B) as count_B
,(Select count (*) as green from C) as count_C
如果我有这三个计数查询,例如:
第一个:
Select count(*) as red
from A
result = 10
第二个:
Select count(*) as yellow
from B
result = 15
第三名:
Select count (*) as green
from C
result = 20
如何使用 oracle 使结果像
red yellow green
10 15 20
select (Select count(*) from a) red, (Select count(*) from b) yellow, (Select count(*) from b) green from dual;
像这样:
select * from (Select count(*) as red from A) as count_A
,(Select count(*) as yellow from B) as count_B
,(Select count (*) as green from C) as count_C