解决方案 »
- 安装oracle 11g发行版,配置安全更新点击下一步出错
- 请教oracle client安装问题
- 请教关于 after update触发器的问题。
- 请教一个存储过程的想法。
- fork出多个进程后,个子进程间能同时操作oracle吗
- Oracel 10g数据库倒到9i 出现 ORA-00010 错误,江湖救急,各位大仙给个良方。
- 改变默认表空间后,数据是全部转到新的默认表空间吗??
- oracle下oem的问题?
- 初学者问题:在ORACLE的LOOP当中有没有类似于DELPHI当中的continue和break的操作
- 怎样在exp出的文件名称后面加上当天的日期?
- 字段值格式如下(001,2|002,2|005,3),要怎样快速的找到该字段中包含值为002,2的记录,该表中的数据量较大(百万起步),除like外有没其它方法
- 转换为规则的字符串
sum(s.main_count) mcount,
sum(s.config_count) ccount,
s.BRANCH_ID
from t_statistic s
where s.tache_id = '3' and s.statistic_project_id = 1 and
s.statistic_user_id in
(182, 183, 184) and
s.statistic_mode = 1 and
to_char(s.statistic_date, 'yyyy-MM-dd') >= '2010-09-27' and
to_char(s.statistic_date, 'yyyy-MM-dd') <= '2010-11-27'
group by s.branch_name ,s.branch_id
order by s.branch_id;
sum(s.main_count) mcount,
sum(s.config_count) ccount,
s.BRANCH_ID
from t_statistic s
where s.tache_id = '3' and s.statistic_project_id = 1 and
s.statistic_user_id in
(182, 183, 184) and
s.statistic_mode = 1 and
to_char(s.statistic_date, 'yyyy-MM-dd') >= '2010-09-27' and
to_char(s.statistic_date, 'yyyy-MM-dd') <= '2010-11-27'
group by s.BRANCH_ID,s.branch_name
order by s.branch_id
sum(s.main_count) mcount,
sum(s.config_count) ccount,
s.BRANCH_ID
from t_statistic s
where s.tache_id = '3' and s.statistic_project_id = 1 and
s.statistic_user_id in
(182, 183, 184) and
s.statistic_mode = 1 and
to_char(s.statistic_date, 'yyyy-MM-dd') >= '2010-09-27' and
to_char(s.statistic_date, 'yyyy-MM-dd') <= '2010-11-27'
group by s.branch_name,s.BRANCH_ID
order by s.branch_id
to_char(s.statistic_date, 'yyyy-MM-dd') >= '2010-09-27' and
to_char(s.statistic_date, 'yyyy-MM-dd') <= '2010-11-27'
这个statistic_date列上面要是没有建函数索引,效率应该欠理想。
sum(s.main_count) mcount,
sum(s.config_count) ccount,
s.BRANCH_ID
from t_statistic s
where
to_char(s.statistic_date, 'yyyy-MM-dd') >= '2010-09-27' and
to_char(s.statistic_date, 'yyyy-MM-dd') <= '2010-11-27' and
s.statistic_user_id in (182, 183, 184) and
s.tache_id = '3' and
s.statistic_mode = 1 and s.statistic_project_id = 1
group by s.branch_name ,s.branch_id
order by s.branch_id;
在statistic_date上建立的一般索引在该SQL中不起作用,要建立关于to_char的函数索引,或者改成
statistic_date between to_date('2010-09-27','yyyy-mm-dd') and to_date('2010-11-27','yyyy-mm-dd hh24:mi:ss')