У меня есть таблица ниже, и я хочу получить значение из предыдущего столбца.
row Planned Site Unit Datetime
Number Hours Name Name
===============================================================
1 0.0000000 Site Unit 2019-07-06 23:59:59.0000000
2 0.0000000 Site Unit 2019-07-06 23:00:00.0000000
3 0.0000000 Site Unit 2019-07-06 22:00:00.0000000
4 0.0000000 Site Unit 2019-07-06 21:00:00.0000000
5 0.0000000 Site Unit 2019-07-06 20:00:00.0000000
6 0.0000000 Site Unit 2019-07-06 19:00:00.0000000
7 0.0000000 Site Unit 2019-07-06 18:00:00.0000000
8 0.0000000 Site Unit 2019-07-06 17:00:00.0000000
9 0.0000000 Site Unit 2019-07-06 16:00:00.0000000
10 0.0000000 Site Unit 2019-07-06 15:00:00.0000000
11 0.0000000 Site Unit 2019-07-06 14:00:00.0000000
12 0.0000000 Site Unit 2019-07-06 13:00:00.0000000
13 0.0000000 Site Unit 2019-07-06 12:00:00.0000000
14 0.0000000 Site Unit 2019-07-06 11:00:00.0000000
15 0.0000000 Site Unit 2019-07-06 10:00:00.0000000
16 0.0000000 Site Unit 2019-07-06 09:00:00.0000000
17 0.0000000 Site Unit 2019-07-06 08:00:00.0000000
18 0.0000000 Site Unit 2019-07-06 07:00:00.0000000
19 0.0000000 Site Unit 2019-07-06 06:00:00.0000000
20 0.0000000 Site Unit 2019-07-06 05:00:00.0000000
21 0.0000000 Site Unit 2019-07-06 04:35:00.0000000
22 0.0000000 Site Unit 2019-07-06 04:00:00.0000000
23 0.0000000 Site Unit 2019-07-06 03:00:00.0000000
24 0.0000000 Site Unit 2019-07-06 02:16:00.0000000
25 0.0000000 Site Unit 2019-07-06 02:00:00.0000000
26 0.0000000 Site Unit 2019-07-06 01:00:00.0000000
27 0.0000000 Site Unit 2019-07-06 00:00:00.0000000
28 0.0000000 Site Unit 2019-07-05 23:00:00.0000000
29 0.0000000 Site Unit 2019-07-05 22:00:00.0000000
30 0.0000000 Site Unit 2019-07-05 21:00:00.0000000
31 0.0000000 Site Unit 2019-07-05 20:00:00.0000000
32 0.0000000 Site Unit 2019-07-05 19:00:00.0000000
33 0.0000000 Site Unit 2019-07-05 18:00:00.0000000
34 0.0000000 Site Unit 2019-07-05 17:00:00.0000000
35 0.0000000 Site Unit 2019-07-05 16:00:00.0000000
36 0.0000000 Site Unit 2019-07-05 15:00:00.0000000
37 0.0000000 Site Unit 2019-07-05 14:00:00.0000000
38 0.0000000 Site Unit 2019-07-05 13:00:00.0000000
39 0.0000000 Site Unit 2019-07-05 12:00:00.0000000
40 0.0000000 Site Unit 2019-07-05 11:00:00.0000000
41 0.0000000 Site Unit 2019-07-05 10:00:00.0000000
42 0.0000000 Site Unit 2019-07-05 09:00:00.0000000
43 0.0000000 Site Unit 2019-07-05 08:00:00.0000000
44 0.0000000 Site Unit 2019-07-05 07:00:00.0000000
45 0.6000000 Site Unit 2019-07-05 06:40:00.0000000
46 0.0000000 Site Unit 2019-07-05 06:01:00.0000000
47 0.0000000 Site Unit 2019-07-05 06:00:00.0000000
48 0.0000000 Site Unit 2019-07-05 05:00:00.0000000
49 0.0000000 Site Unit 2019-07-05 04:00:00.0000000
50 0.0000000 Site Unit 2019-07-05 03:00:00.0000000
51 0.0000000 Site Unit 2019-07-05 02:00:00.0000000
52 0.0000000 Site Unit 2019-07-05 01:00:00.0000000
53 0.7000000 Site Unit 2019-07-05 00:43:00.0000000
54 0.0000000 Site Unit 2019-07-05 00:00:00.0000000
Я использую функцию LAG в PlannedHours. но когда условие where, примененное к datetime, предыдущее значение Plannedours равно null, но я хочу, чтобы предыдущее значение datetime в последний час.
Заранее спасибо.