I want to select patient_id and date difference from below table:
p_id TreatmentDate
15 2008-05-01
15 2008-05-03
15 2008-05-05
15 2008-05-07
16 2008-05-01
16 2008-05-03
16 2008-05-05
16 2008-05-09
16 2008-05-11
17 2008-05-03
17 2008-05-05
17 2008-05-07
I want to have this result:
p_id Day Difference
15 6 Days
16 10 Days
17 4 Days
Do you have any offer that can generate this result in sql statement.