Good day everyone!
I do not think how to approach the task.
There is a data table with the fields report_date (reporting date), inn (employer), client_id (employee), for simplicity, we assume that report_date takes 2 values ​​- 01/01/2018 and 01.12.2017.
It is necessary to withdraw employers (inn), who changed the TIN, i.e. withdraw old and new inn.
One organization can be absorbed by another. At the same time, the TIN of the absorbed company changes (for one period) to the TIN of the absorbed company. Determine the TIN of the absorbed companies, and the companies that absorbed them. Those. In this unloading you need to find the changes that occurred in January compared with December.
There is a rule that a company is considered to have changed the TIN, if at least 90% of the employees in the company change the TIN next month, while the former TIN in the next reporting period will not have a single employee.