EmployeeSalaryGradeID BeginDate EndDate
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2017-01-01 2019-11-30
EA0949F0-25 c8-42 BC - 970 - d - 2019-12-01 BF572258309B NULL
The first BeginDate: 2017-01-01; EndDate: 2019-11-30
Article 2 BeginDate: 2019-12-01; EndDate: NULL (EndDate is NULL, can treat as DateTime maximum value, namely the 9999-12-31,)
Want to effect:
# 1: now I need to according to every year to handle:
For example,
If I want to check the 2016, do not check the record, because the above two records, BeginDate minimum is 2017-01-01,
If I want to check the 2019, so there are 12 records need to be found out,
Respectively is:
EmployeeSalaryGradeID BeginDate EndDate
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-01-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-02-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-03-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-04-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-05-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-06-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-07-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-08-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-09-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-10-01
10 f8c063 - d7d C3B4-4 - BA0A - DF8125BE5516 2019-11-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2019-12-01
If I want to check the 2020, so there are 12 records need to be found out,
Respectively is:
EmployeeSalaryGradeID BeginDate EndDate
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-01-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-02-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-03-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-04-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-05-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-06-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-07-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-08-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-09-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-10-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-11-01
EA0949F0-25 c8-42 BC - 970 - d - BF572258309B 2020-12-01
: is the need to select the specific year record, and then by month break up, how to achieve this effect? Online, etc., grateful!
CodePudding user response:
Don't sink, don't sink, don't sink,CodePudding user response:
From the top, top, top, top,