仅使用子选择的Oracle查询

时间:2013-09-20 12:44:24

标签: sql oracle

我只想返回包含三列的1行

(SELECT count(1) from tests) TestCount, 
(select count(1) from customers) CustomerCount, 
(select count(1) from patients) PatientCount

2 个答案:

答案 0 :(得分:5)

请尝试:

select 
  (SELECT count(1) from tests) TestCount, 
  (select count(1) from customers) CustomerCount, 
  (select count(1) from patients) PatientCount
from dual;

答案 1 :(得分:0)

SELECT  TestCount.TestCount,
        CustomerCount.CustomerCount,
        PatientCount.PatientCount
FROM    (SELECT count(1) TestCount from tests) TestCount
        CROSS JOIN
        (select count(1) CustomerCount from customers) CustomerCount
        CROSS JOIN
        (select count(1) PatientCount from patients) PatientCount