先group by 再order by
解决方案 »
- 分区表空间
- 急求 《Oracle Database 10g DBA手册》 电子书中、英文版本!!高分回报!!
- 数据库是sql server的成品软件怎样使用oracle数据库?
- 如何得到当前周是该季度的第几周?
- 又是横表转纵表的问题啊?
- 有哪位仁兄给我一个CNOUG的邀请码
- sql语句 判断记录是否存在的问题
- 急求 oeacle 数据库
- 虔诚求解:为该监听程序提供的信息正由此计算机上的其他监听程序使用,可以按现状继续配置,但只有在解决冲突之后才能启动该监听程序。
- Oracle 中的视图可以建索引吗?
- 谁有oracle JDeveloper 10G 的使用方法文档?
- 求解決方案,高手指點,謝謝!
from
(select a,b,sum(c) ,sum(d) as ad
from
(
select a,b,c,d
from table1,table2
union
select a,b,c,d
from table1,table3
)
group by a,b)
where ac<>0 or ad <>0
order by a
from
(
select a,b,c,d
from table1,table2
union
select a,b,c,d
from table1,table3
)
where ac<>0 or ad <>0
group by a,b
order by a
from
(
select a,b,c,d
from table1,table2 --为什么没有条件
union
select a,b,c,d
from table1,table3 --为什么没有条件 )
group by a,b
Having sum(c)<>0 or sum(d)<>0
from
(
select a,b,c,d
from table1,table2
union
select a,b,c,d
from table1,table3
) temp
where temp.ac<>0 or temp.ad <>0
group by temp.a,temp.b
order by temp.a
select a,b,sum(c) as ac,sum(d) as ad
from
(
select a,b,c,d
from table1,table2
union
select a,b,c,d
from table1,table3
)
where ac<>0 or ad <>0
group by a,b
having sum(c)<>0 or sum(d)<>0
order by a
select a,b,sum(c) as ac,sum(d) as ad
from
(
select a,b,c,d
from table1,table2
union
select a,b,c,d
from table1,table3
)
group by a,b
having sum(c)<>0 or sum(d)<>0
order by a