After making a query, I get this data in this format:
I need to set up a query that pairs dates related to same id and counts the difference in days. the result should be like this:
I'm using postgresql. Could you please help me to set up the query to get the desired output ? Thanks in advance

