I am using LAG SQL function to get the difference of 2 consecutive dates in the records. THe issue is, the result it is returning is in DATE -TIME format whereas I want it either to be in Days, or hours. Attached is Output it outcome and the expected result.
Code:
select
*,
(action_date - lag(action_date) over (partition by voucher_no order by action_date)) as diff
from cte3

DATEDIFFrather than-.