一共四个表,俩个问题
select count(*) from aaunion
select count(*) from bbunion
select count(*) from ccunion
select count(*) from dd;第一个难题
我想看这四个表都有多少条数据,这样显示
aa bb cc dd
2 34 45 2
第二个难题
我想看这四个表中都是什么数据,也就是说,把这四个表的所有数据都显示出来。
谁能回答我的问题,我算谁厉害!!
select count(*) from aaunion
select count(*) from bbunion
select count(*) from ccunion
select count(*) from dd;第一个难题
我想看这四个表都有多少条数据,这样显示
aa bb cc dd
2 34 45 2
第二个难题
我想看这四个表中都是什么数据,也就是说,把这四个表的所有数据都显示出来。
谁能回答我的问题,我算谁厉害!!
select
(select count(*) from aaunion) aa,
(select count(*) from bbunion) bb,
(select count(*) from ccunion) cc,
(select count(*) from dd ) dd
from dual
第二个楼主要怎么显示?
select * from aa;
select * from bb;
select * from cc;
select * from dd;
就可以分页显示了。
你四个表如果表结果不一样的话不可能用一条语句就可以显示四张表的。
from (select rownum ai, a.* from a) aa,
(select rownum bi, b.* from b) bb,
(select rownum ci, c.* from c) cc,
(select rownum di, d.* from d) dd
where aa.ai = bb.bi(+)
and aa.ai = cc.ci(+)
and aa.ai = dd.di(+)
(select count(*) from aaunion) aa,
(select count(*) from bbunion) bb,
(select count(*) from ccunion) cc,
(select count(*) from dd ) dd