There is a table Stag ( PersonNumber, DataStart, DataFinish, Dolgnost, MestoRaboty
).
For example: there are such lines in this table.
1, 2001-01-01, 2010-01-01, Менеджер, Банк 1, 2010-02-10, null, Менеджер, Отель
I do the procedure so that it displays a list of people whose experience, let's say more than 10 years ...
null-i mean that a person works here and is not fired.
Based on these two lines, the experience in the amount of> 10! How to make so that all lines with the same number of the employee would be looked through and summed up?
I use DATEDIFF
and CURRENT_TIMESTAMP
, but I don’t understand how ...