Reputation: 13
Here is a sample of what I have in my table (SQL Server):
patientID DateCreated StartOn EndOn
---------------------------------------------------
1234 2015-09-16 2015-09-01 2015-09-30
2345 2015-09-16 2015-09-01 2015-09-30
2346 2015-09-16 2015-09-01 2015-09-30
Currently, it counts the "days" to be 30. So it is really looking at days elapsed between StartOn
and EndOn
. I want to be able to do this counting based on StartOn
and DateCreated
. So, in my example the "days" should be 16, that is days elapsed from StartOn
to DateCreated
.
Upvotes: 1
Views: 73
Reputation: 157
So you can go with:
Select (EndOn - DateCreated +1) As "Days"
from Tablename
where patientID = 1234;
Upvotes: 0