Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

TSQL - Logic driven by two most recent rows

Language: Layout:
View schema
Execution time: 0,09 sec, rows selected: 18, rows affected: 19, absolute service time: 0,25 sec  
fork mode |  history  | discussion
   Room_Id Status Inspection_Date
1 3 vacant 22.03.2016 00:00:00
2 3 vacant 12.12.2015 00:00:00
3 3 vacant 27.08.2015 00:00:00
4 4 vacant 25.03.2016 00:00:00
5 4 vacant 24.03.2015 00:00:00
6 4 occupied 02.02.2015 00:00:00
   Room_Id Status Inspection_Date
1 3 vacant 22.03.2016 00:00:00
2 3 vacant 12.12.2015 00:00:00
3 3 vacant 27.08.2015 00:00:00
4 4 vacant 25.03.2016 00:00:00
5 4 vacant 24.03.2015 00:00:00
6 4 occupied 02.02.2015 00:00:00
7 5 occupied 24.03.2016 00:00:00
8 5 occupied 24.03.2016 00:00:00
9 5 vacant 19.01.2016 00:00:00
10 5 vacant 19.01.2016 00:00:00
11 5 vacant 21.05.2015 00:00:00
12 5 vacant 21.05.2015 00:00:00