Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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:

EmployeeMonthYear
1Jan2015
2Jan2015
3Jan2015
1Feb2015
1Mar2015

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?

Thanks in advance,

Jacek

1 Reply
Not applicable
Author

Hi Jacek,

I would do it in following way:

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.

Hope it is clear.