Willian Chia
Willian Chia

Reputation: 61

Datediff between 2 columns in same table

I've got 2 date columns in my table (start_date, end_date).

I've tried Datediff(day, start_date, end_date), but I was prompt with:

invalid column name


How can I calculate the date difference between these 2 columns?

Upvotes: 4

Views: 47137

Answers (4)

LuigiR
LuigiR

Reputation: 1

be certain that your columns are formated correctly to either be a DATE or DATETIME

Upvotes: 0

Deepshikha
Deepshikha

Reputation: 10264

select DATEDIFF (day,start_date,end_date) from yourtablename;

Upvotes: 9

Chamal
Chamal

Reputation: 1449

It should be "day"

Datediff(day, start_date, end_date) 

Upvotes: 0

codingbiz
codingbiz

Reputation: 26386

Should be Datediff(day, start_date, end_date). There is no 's' at the end of the day

Upvotes: 2

Related Questions