Setting flag in script, comparision of months problem
Hi guys,
I have a table that represents people and month and year they are employed. It looks like this:
Employee
Month
Year
1
Jan
2015
2
Jan
2015
3
Jan
2015
1
Feb
2015
1
Mar
2015
I want to set a flag to a person that was employed last month and not employed next month. For example if a person is not in Feb or March (like Employee 2 and 3 ) they left their job, so i want to put a flag to person 2 and 3 in Jan that they are not emplyed later. How do i compare person and month in script?
1. Make date using year and month from your table.
2. Create another table with Employee and max date.
Find all employes who doesn't work any more. Max date for each employe compare to current date. In case of max date is in current months flag not needed in another case flag needed.
3. left join to original table records with flag only.