小编dhS*_*dhS的帖子

Find the days difference between two dates per month

I have a table 'data' in which there are two columns i.e. Startdate and Enddate.

Startdate is the date when an employee joined working in a company and Enddate is the date when he left. I need to find the working days of employee per month.

If the Startdate is '2015-06-21' and the Enddate is '2015-08-21' then the working days will be:

June 10days
July 31days
August 21days
Run Code Online (Sandbox Code Playgroud)

I have the query for the total days for the work:

Select …
Run Code Online (Sandbox Code Playgroud)

sql-server-2005 sql-server

3
推荐指数
2
解决办法
2800
查看次数

标签 统计

sql-server ×1

sql-server-2005 ×1