Q:

SQL- how to retrieve by similar dates

Okay, so I have a table with a user_id column and a submitted_dtm column. 
I want to find instances where users submitted multiple records within 1 day of each other, and count how many times that has happened. 
I've tried something like
select * from table_t t where 
(select count(*) from table_t t2 where 
t.user_id = t2.user_id and
t.pk!=t2.pk and
t.submitted_dtm between t2.submitted_dtm-.5 and t2.submitted_dtm+.5)>0; 

The problem is that this query returns a result for each record in a date group.  Instead, I just want a result per date group. Ideally, I'd just get the count in that group. 
That is, if I have 6 records: 
user_id     submitted_dtm
--------------------------
1            12/04/2017 1:15
1            12/04/2017 5:50
2            11/25/2017 2:00
2            11/25/2017 3:25
2            11/25/2017 6:05
2            10/06/2017 4:00

I want 2 results, a count of 2 and a count of 3. 
Is it possible to do this in sql? 

A:

Following up on Dessma's answer.
select user_id, trunc(submitted_dtm), count(1)
  from table_t
 group by user_id, trunc(submitted_dtm)
having count(1) > 1;

Sqlfiddle

A:

In Oracle 12.1 and higher, you can solve such problems easily with the match_recognize clause. Link to documentation (with examples) below; my only note about the solution below is that I left the date in DATE data type, especially important if the output is used in further computations. If it isn't, you can wrap within TO_CHAR() with whatever format model is appropriate for your users.
https://docs.oracle.com/database/121/DWHSG/pattern.htm#DWHSG8956
with
  inputs ( user_id, submitted_dtm ) as (
    select 1, to_date('12/04/2017 1:15', 'mm/dd/yyyy hh24:mi') from dual union all
    select 1, to_date('12/04/2017 5:50', 'mm/dd/yyyy hh24:mi') from dual union all
    select 2, to_date('11/25/2017 2:00', 'mm/dd/yyyy hh24:mi') from dual union all
    select 2, to_date('11/25/2017 3:25', 'mm/dd/yyyy hh24:mi') from dual union all
    select 2, to_date('11/25/2017 6:05', 'mm/dd/yyyy hh24:mi') from dual union all
    select 2, to_date('10/06/2017 4:00', 'mm/dd/yyyy hh24:mi') from dual
  )
-- End of simulated inputs (for testing only, not part of the solution).
-- SQL query begins below this line. Use your actual table and column names.
select user_id, submitted_dtm, cnt
from   inputs
match_recognize(
  partition by user_id
  order by     submitted_dtm
  measures     trunc(a.submitted_dtm) as submitted_dtm,
               count(*) as cnt
  pattern      ( a b+ )
  define       b as trunc(submitted_dtm) = trunc(a.submitted_dtm)
);

   USER_ID SUBMITTED_DTM              CNT
---------- ------------------- ----------
         1 2017-12-04 00:00:00          2
         2 2017-11-25 00:00:00          3

