Help on calculating the biggest difference between dates

Hi,

I have one table with the following data:

Unit
Event date
xxx 10/11/2017
xxx 04/03/2015
zzz 01/02/2018
yyy 06/06/2016
zzz 09/09/2018
xxx 12/12/2017
yyy 08/09/2016
www 01/01/2018



I need to extract the biggest difference between two dates per Unit and store on another data table, like this:

Unit
Record (days)
www 344
xxx 1014
yyy 94
zzz 220

If there's only one event for a given Unit, the difference must be calculated between today and the date of that event. There will be at least one event per Unit on the table.

Can you guys help me on that? Any idea?

Thanks in advance!

(1) Answer

Login