. , . datetime. , , , (). :
select t.*
from (select t.*,
count(*) over (partition by userid, interval) as CntInInterval
from (select trunc(orderdate)+
(floor(((orderdate - trunc(orderdate))*24*60)/10)*10)/(24*60) as interval, t.*
from t
) t
) t
where cntInInterval > 1
, :
select interval, count(*)
from (select trunc(orderdate)+floor(((orderdate - trunc(orderdate))*24*60)/10)*10 as interval, t.*
from t
) t
group by interval
"10" . , , 17 17 .
.
trunc (orderdate) + floor (((orderdate - trunc (orderdate)) * 24 * 60)/10) * 10 ,
, trunc(orderdate), Oracle . .
orderdate - trunc(orderdate) - . , 0,25 6:00 . *24*60 . , 0.25 0.25 * 60 * 24 = 360 - .
floor(x/y)*y "" y. , floor(118/10) 11, 11 * 10 110. , a * y (a + 1) * y ( ) , a * y.
, 6:08 2013-01-01:
`trunc(orderdate)` moves the date to midnight on 2013-01-01.
`orderdate - trunc(orderdate)` creates a number like 0.25.
`((orderdate - trunc(orderdate))*24*60)` produces the value 368
`floor(((orderdate - trunc(orderdate))*24*60)/10)*10` produces 360
`floor(((orderdate - trunc(orderdate))*24*60)/10)*10*(1/24*60)` produces 0.25
, 6:00 .