欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

oracle 取某個(gè)時(shí)間段的數(shù)據(jù)(每周幾的上午幾點(diǎn)到幾點(diǎn))

 更新時(shí)間:2020年01月05日 10:54:16   作者:棒棒糖_26  
這篇文章主要介紹了oracle 取某個(gè)時(shí)間的數(shù)據(jù)(每周幾的上午幾點(diǎn)到幾點(diǎn)),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

oracle 取某個(gè)時(shí)間段的數(shù)據(jù),具體代碼如下所示:

select count(*),t.分組字段 from (
select t.* ,to_char(t.時(shí)間,'HH24') stime,to_char(t.時(shí)間,'HH24mi') fz,to_char(時(shí)間,'d') 
from A t
where 時(shí)間>=to_date('2019-12-01','yyyy-MM-dd') and ghsj<=to_date('2019-12-31','yyyy-MM-dd') and to_char(時(shí)間,'d')='2'
) where stime in ('08','09','10','11','12') and fz>=0800 a 
group by T.分組字段

to_char(時(shí)間,'d') 取當(dāng)前時(shí)間是星期幾 每星期第一天為周日

to_char(t.時(shí)間,'HH24mi') 取當(dāng)前時(shí)間的小時(shí)分

o_char(t.時(shí)間,'HH24') 取當(dāng)前時(shí)間的小時(shí)

ps:oracle 同一個(gè)數(shù)據(jù)有多條記錄,根據(jù)條件取時(shí)間最大的那一條

1.第一種方式

select max(t1.INVALID_TIME) from T_CUSTOMER t1 where t1.customer_code = '5101'

1.第二種方式

SELECT INVALID_TIME FROM (SELECT * FROM T_CUSTOMER WHERE customer_code='5101' ORDER BY INVALID_TIME desc) WHERE ROWNUM =1

1.第三種方式

select INVALID_TIME from T_CUSTOMER t where INVALID_TIME=(select max(INVALID_TIME) from T_CUSTOMER where customer_code='5101') and ROWNUM =1 

5.不過(guò)濾存在多條最大時(shí)間

select INVALID_TIME from T_CUSTOMER t wheret.INVALID_TIME = (select max(t1.INVALID_TIME) from T_CUSTOMER t1 where t1.customer_code = '5101')

總結(jié)

以上所述是小編給大家介紹的oracle 取某個(gè)時(shí)間段的數(shù)據(jù)(每周幾的上午幾點(diǎn)到幾點(diǎn)),希望對(duì)大家有所幫助!

相關(guān)文章

最新評(píng)論