select m.username,
m.jobcount as totalcount,
(select jobcount from vmonthinsertyes where username=m.username and yearmonth=m.yearmonth) as Yescount,
(select jobcount from vmonthinsertno where username=m.username and yearmonth=m.yearmonth) as Nocount,
m.yearmonth as jobdate from vmonth m where
m.operateway='录入'
and m.yearmonth>='2004-01'
and m.yearmonth<='2005-01'
and m.username='lb'
m.jobcount as totalcount,
(select jobcount from vmonthinsertyes where username=m.username and yearmonth=m.yearmonth) as Yescount,
(select jobcount from vmonthinsertno where username=m.username and yearmonth=m.yearmonth) as Nocount,
m.yearmonth as jobdate from vmonth m where
m.operateway='录入'
and m.yearmonth>='2004-01'
and m.yearmonth<='2005-01'
and m.username='lb'
解决方案 »
- 817升级到10g,哪位大侠 教一下详细步骤啊
- 如何将一个CSV文件导入oracle中的两个表中
- 如何格式化输出的数字100.00- 为-100.00;100.00+为+100.00,谢谢!
- 一个ORACLE(9i) 预编译器(pro c/c++)生成一个.cpp文件在VC++(6.0)中无法执行?
- plsql下如何导出生产库里的所有用户/表空间/dblink的创建脚本(oracle)?
- oracle 9i 简体转繁体 等待中
- 求一sql
- 请问一个简单的问题(急)
- 请问主键和唯一索引究竟有什么区别,是否能够告知。。。。
- 请问Oracle 中图片存储的问题(blob)
- @@ 关于两条分页SQL语句的实际性能优劣比较。请有海量数据的朋友帮忙简单测试一下速度。
- Oracle9i,导出整个数据库,原来很快,现在慢
max((select jobcount from vmonthinsertyes where username=m.username and yearmonth=m.yearmonth)) as Yescount,
max((select jobcount from vmonthinsertno where username=m.username and yearmonth=m.yearmonth)) as Nocount,
max(m.yearmonth) as jobdate from vmonth m where
m.operateway='录入'
and m.yearmonth>='2004-01'
and m.yearmonth<='2005-01'
and m.username='lb'
group by m.username
SELECT * FROM
(
select m.username AS username ,
m.jobcount AS totalcount,
(select jobcount from vmonthinsertyes where username=m.username and yearmonth=m.yearmonth) AS Yescount,
(select jobcount from vmonthinsertno where username=m.username and yearmonth=m.yearmonth) AS Nocount,
m.yearmonth AS jobdate
from vmonth m
where m.operateway='录入'
and m.yearmonth>='2004-01'
and m.yearmonth<='2005-01'
and m.username='lb'
)MSTB
group by MSTB.username
sum((select jobcount from vmonthinsertyes where username=m.username and yearmonth=m.yearmonth)) as Yescount,
sum((select jobcount from vmonthinsertno where username=m.username and yearmonth=m.yearmonth)) as Nocount,
m.yearmonth as jobdate from vmonth m where
m.operateway='录入'
and m.yearmonth>='2004-01'
and m.yearmonth<='2005-01'
and m.username='lb'
group by m.username,jobdate;