I have a query where I should record the rows with error with the word History, the rows that bring the date LESS than any of the dates of the previous rows should display the word HISTORICAL,
Can you help? the column in question is TYPE,
The result should look like the table below.
Tb_importance [title_code, date, imp_situation]
CD Item ValA ValB Data Tipo
01 A 10 15 2017-05-01 00:01:57.000 0
02 A 10 15 2017-05-01 00:02:15.000 0
03 A 10 15 2017-05-01 00:02:20.000 0
04 A 10 15 2017-05-01 00:03:40.000 0
05 A 10 15 2017-05-01 00:03:35.000 HISTORICO!
06 A 10 15 2017-05-01 00:04:20.000 0
07 A 10 15 2017-05-01 00:04:25.000 0
08 A 10 15 2017-05-01 00:04:50.000 0
09 A 10 15 2017-05-01 00:04:10.000 HISTORICO!
10 A 10 15 2017-05-01 00:04:30.000 0 <-- ??
11 B 10 15 2017-05-01 00:05:10.000 0
12 B 10 15 2017-05-01 00:05:30.000 0
13 B 10 15 2017-05-01 00:05:05.000 HISTORICO!
14 B 10 15 2017-05-01 00:05:50.000 0