0
How to count days between two dates?
I have entered data of employees work on different date now i want to calculate no of days work done by employees with their name.
2 ответов
+ 1
I think something like this should work
SELECT DATEDIFF(STR_TO_DATE(date1, '%m/%d/%Y'),STR_TO_DATE(date2, '%m/%d/%Y')) AS DAYS
FROM TABLE1
Your DATE field should have DATE or DATETIME format to be used as DATEDIFF argument correctly.
0
The DATEDIFF() function returns the time between two dates.
Syntax
DATEDIFF(datepart,startdate,enddate)
Example
SELECT DATEDIFF(day,'2014-06-05','2014-08-05') AS DiffDate