I was searching a lot, and trying and trying again, I really don’t know how to solve my problem, maybe because I don’t know how SQL requirements works and treat tables.
Here is my problem. I have one table with columns (id, sentdate, data) . One of the column is date (sentdate) as example “2011-03-21 05:17:48”. What I need is to compare first date with second and get the difference of days, then second with third and get difference of day…and so on. Finally I want to get the highest interval of day with the begin date and end date. I’m using PostgreSQL
If you want the difference in integer days: