真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

oracle中如何按小時(shí) oracle時(shí)間加1小時(shí)

Oracle數(shù)據(jù)按小時(shí)分組的語句

創(chuàng)建測試表,隨便弄了點(diǎn)數(shù)據(jù):

我們注重客戶提出的每個(gè)要求,我們充分考慮每一個(gè)細(xì)節(jié),我們積極的做好成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)服務(wù),我們努力開拓更好的視野,通過不懈的努力,創(chuàng)新互聯(lián)建站贏得了業(yè)內(nèi)的良好聲譽(yù),這一切,也不斷的激勵(lì)著我們更好的服務(wù)客戶。 主要業(yè)務(wù):網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)站設(shè)計(jì),微信小程序,網(wǎng)站開發(fā),技術(shù)開發(fā)實(shí)力,DIV+CSS,PHP及ASP,ASP.Net,SQL數(shù)據(jù)庫的技術(shù)開發(fā)工程師。

create?table?test

(timestamp?date);

insert?into?test?values?(to_date('2017-12-7?9:00:00','yyyy-mm-dd?hh24:mi:ss'));

insert?into?test?values?(to_date('2017-12-7?9:01:00','yyyy-mm-dd?hh24:mi:ss'));

insert?into?test?values?(to_date('2017-12-7?11:00:00','yyyy-mm-dd?hh24:mi:ss'));

insert?into?test?values?(to_date('2017-12-7?11:20:00','yyyy-mm-dd?hh24:mi:ss'));

insert?into?test?values?(to_date('2017-12-7?11:30:00','yyyy-mm-dd?hh24:mi:ss'));

commit;

執(zhí)行:

select?to_char(timestamp,'yyyy-mm-dd?hh24')||':00:00',count(*)?from?test?group?by?to_char(timestamp,'yyyy-mm-dd?hh24')||':00:00'

結(jié)果:

只針對時(shí)間字段為date類型有效,其他類型的話需要改語句。

oracle按小時(shí)分組查詢

select

decode(tl, '00:00——00:30', to_char(a-1,'yyyymmdd'), to_char(a,'yyyymmdd')) as 天,

decode(tl, '00:00——00:30', '16:31——00:30', '16:31——00:00', '16:31——00:30', t1) as 時(shí)間段,

sum(b)

from

(

select

a,

case

when to_char(a, 'hhmi') ='0030' then '00:00——00:30'

when to_char(a, 'hhmi') between '0031' and '0830' then '00:30——08:30'

when to_char(a, 'hhmi') between '0031' and '1630' then '00:31——16:30'

when to_char(a, 'hhmi') = '1631' then '16:31——00:00'

else ''

end as tl,

b

from table_name

)

group by

decode(tl, '00:00——00:30', to_char(a-1,'yyyymmdd'), to_char(a,'yyyymmdd')),

decode(tl, '00:00——00:30', '16:31——00:30', '16:31——00:00', '16:31——00:30', t1)

oracle中怎么按每小時(shí)分組。數(shù)據(jù)如下:

select time,count(time) from (

select substr('2014-01-01 20:03:00',1,13) as time from table_name) group by time;


文章名稱:oracle中如何按小時(shí) oracle時(shí)間加1小時(shí)
網(wǎng)址分享:http://weahome.cn/article/hgsodg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部