oracle从两个不同表中查询的结果 怎么合并
是这样的有两张表table1table2我要显示如下table1的行数table2的行数我写了两个sql语句selectcount(*)fromtable1;select...
是这样的
有两张表
table1
table2
我要显示如下
table1的行数 table2的行数
我写了两个sql语句
select count(*) from table1;
select count(*) from table2;
我现在就想将两条sql语句变成一条sql语句
非常感谢 展开
有两张表
table1
table2
我要显示如下
table1的行数 table2的行数
我写了两个sql语句
select count(*) from table1;
select count(*) from table2;
我现在就想将两条sql语句变成一条sql语句
非常感谢 展开
2个回答
展开全部
SELECT
(select count(*) from table1 ) AS COUNT_1 ,
(select count(*) from table2 ) AS COUNT_2
FROM DUAL
或者
SELECT X.COUNT_1,Y.COUNT_2
FROM
( select count(*) AS COUNT_1 from table1 ) X,
(select count(*) AS COUNT_2 from table2 ) Y
(select count(*) from table1 ) AS COUNT_1 ,
(select count(*) from table2 ) AS COUNT_2
FROM DUAL
或者
SELECT X.COUNT_1,Y.COUNT_2
FROM
( select count(*) AS COUNT_1 from table1 ) X,
(select count(*) AS COUNT_2 from table2 ) Y
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询