@yosiasz Thanks again. I ran this query with the min and max:
declare @seahawks table(employee int, position varchar(50), job_id varchar(50),department int,
effect_Date date, end_date date)
insert into @seahawks
values
(100, '9000-50000', 5000,9000,'2020-08-31', '2021-05-29'),
(100, '9000-50000', 5000,9000,'2021-05-31', '2021-06-12'),
(100, '8000-40000', 4000,8000,'2021-06-13', '2021-06-26'),
(100, '8000-40000', 4000,8000,'2021-06-27', '2021-07-31'),
(100, '9000-50000', 5000,9000,'2021-08-01', '2050-01-01')
select employee, position, job_id, min(effect_Date) begin_date, max(end_date) end_date
from @seahawks
group by employee, position, job_id
I'm looking to separate out the date from when the employee transferred. So the table results would look like this query:
declare @seahawks1 table(employee int, position varchar(50), job_id varchar(50),department int,
effect_Date date, end_date date)
insert into @seahawks1
values
(100, '9000-50000', 5000,9000,'2020-08-31', '2021-06-12'),
(100, '8000-40000', 4000,8000,'2021-06-13', '2021-07-31'),
(100, '9000-50000', 5000,9000,'2021-08-01', '2050-01-01')
select employee, position, job_id, min(effect_Date) begin_date, max(end_date) end_date
from @seahawks1
group by employee, position, job_id
Any help would be much appreciated.
Thank you.