最基础的sum用法再加个外连接,建议楼主看看相关文档
解决方案 »
- PLS-00103错误,大家来看下,帮帮忙啊
- 定时器定时调用存储过程后,写入日志表中
- 结果数量为什么不同?
- 高性能应用问题.请高手指教,不限于ORACLE
- 用PLSQL Developer 打开数据表,窗口就自动关掉了,为什么啊?
- 分页查询语句如何查询出rowid ??? ????
- 我能建立其他session不可见的临时表吗?
- 求教:还是关于oracle的会话
- 向老大们请教一个从数据库中返回多行结果级的问题,难点使用的游标存在于动态SQL语句
- php连接oracle,tanames.ora文件要怎么配置呢,多谢多谢,急
- 怎样屏蔽查询DB_LINKS
- 在线等!急!在linux下安装9i建立数据库的时候总是蹦出来"invalid entry size(expected 429924352 but got 429924342"?
FROM a RIGHT JOIN b ON (a.no = b.no AND a.line = b.line)
GROUP BY (b.no, b.line),b.NAME
from (select no, line ,sum(sum) snum from a group by no, line)c, b
where b.no = c.no(+) and b.line = c.line(+)
select b.id,b.line,b.name,sum(nvl(a.num,0)) he from a,b
where b.id=a.id(+) and b.line=a.line(+)
group by b.id,b.line,b.name;
或
select b.id,b.line,b.name,nvl(sum(a.num),0) he from a,b
where b.id=a.id(+) and b.line=a.line(+)
group by b.id,b.line,b.name;
select b.id,b.line,b.name,sum(nvl(a.num,0)) he from a,b
where b.id=a.id(+) and b.line=a.line(+)
group by b.id,b.line,b.name;