Yes, some more info would be helpful indeed, but this is probably what you want:
select EMP_NUM, TRAN_DT,
ROW_NUMBER() OVER (PARTITION BY EMP_NUM, dummy ORDER BY TRAN_DT) as consecutive_days
from
(
select TRAN_DT, EMP_NUM,
TRAN_DT - ROW_NUMBER() OVER (PARTITION BY EMP_NUM ORDER BY TRAN_DT) as dummy
from
(
select distinct TRAN_DT, TRAN_TYPE, EMP_NUM
from MYTABLE
where TRAN_TYP = 'A'
) as dt
) as dtDieter
↧