select )) h, )) m, )) s from gat_data_record gdr where gdr.enddt between to_date('2011-1-1','yyyy-mm-dd') and to_date('2014-2-1','yyyy-mm-dd') 1.获得时间差毫秒数: select ceil((To_date('2008-05-02 00:00:00' , 'yyyy-mm-dd hh24-mi-ss') - To_date('2008-04-30 23:
select * from ( selectclass 班级,subject,avg(grade) avg_gradefrom student_score group by class,subject) pivot (sum(avg_grade) for subject in ('语文', '数学','英语')) order by 班级 asc 求班级平均分select 学科,平均分 别名 from 表where class="121"就是group by 班级,平均分 1.121班的
--根据每个部门来统计部门工资总和 select deptid, sum(sal) 工资合计 from emp group by deptid; --根据每个部门来统计部门工资总和select deptid, 工资合计, sum(工资合计) over() as 总合计 from (select deptid, sum(sal) 工资合计 from emp group by deptid) x; select deptid 部门, 工资合计, 总
我自己实现的脚本: select T31267.CREATED_DATE as F31265, (select to_char(to_date(T31267.CREATED_DATE,'yyyy-mm-dd'),'yyyyiw') from dual) as week from LEAP.HMDM_DM_DLR_CLUE T31267 总结: select to_char(TO_DATE('20110101', 'YYYYMMDD'), 'yyyyiw') as week, --oracle求
oracle数据库对test_table表的三个列count1,count2,count3求sum的两种sql,做个记录 第一种 select sum (case when count1 is not null then count1 when count2 is not null then count2 when count3 is not null then count3 else '0' end ) a from test_table 第二种 select sum(decode(count