Reputation: 4842
I have a table which looks like this:
datestamp
2020-04-01
2020-04-02
I am trying to do two things:
So that I would get a result like this:
datestamp diff
2020-04-01 275
2020-04-02 274
What I've tried:
DATEDIFF(day, datestamp, '2020-12-31 00:00:00.0000000')
I get:
DATEDIFF(day, datestamp, '2020-12-31 00:00:00.0000000')
Where is my mistake?
Upvotes: 0
Views: 29
Reputation:
Simply subtract the values:
select datestamp, date '2020-12-31' - datestamp as diff
from the_table;
This assumes that datestamp
is a date
column.
Upvotes: 2