0

I need to find what the date is X% between two date fields. The use case is I want to send an email to someone who is 70% of the way through their tenancy.

For example,

Move-in date = 01/01/20
Move-out date = 31/01/20
Reminder date (70%) = 22/01/20

Is there a simple way to do this within one SQL? From what I've found so far, it's possible to find the percentage, but not the date it equates to.

2

You can do this using the functions DateAdd, DateDiff and a multiplication. The query could look like this:

SELECT
  DateAdd(day, DateDiff(day, movein, moveout)*0.7, movein) as [reminder_date]
FROM
  exampletable

For your example this results in the date 2020-01-22.

Further resources:

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.