Guest User

Untitled

a guest
Apr 25th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Freezer | Timestamp | Temperature_1
  2. 1 2018-04-25 09:45:00 10
  3. 1 2018-04-25 09:50:00 11
  4. 1 2018-04-25 09:55:00 11
  5.  
  6.  
  7. Freezer | Timestamp | Temperature_2
  8. 1 2018-04-25 09:46:00 15
  9. 1 2018-04-25 09:52:00 13
  10. 1 2018-04-25 09:59:00 12
  11.  
  12. Freezer | Timestamp | Temperature_1 | Temperature_2
  13. 1 2018-04-25 09:45:00 10 15
  14. 1 2018-04-25 09:50:00 11 13
  15. 1 2018-04-25 09:55:00 11 12
  16.  
  17. SELECT A.Freezer, A.Timestamp, Temperature_1,Temperature_2 From TABLE_A as A
  18. RIGHT JOIN TABLE_B as B
  19. ON A.FREEZER = B.FREEZER
  20. WHERE A.Timestamp = B.Timestamp (this of course doesn't work because timestamps aren't the same)
  21.  
  22. SELECT Temperature_1
  23. From TABLE_A A JOIN
  24. TABLE_B B
  25. ON A.FREEZER = B.FREEZER AND
  26. A.Timestamp >= DATEADD(minute, -5, B.TimeStamp) AND
  27. A.Timestamp <= DATEADD(minute, 5, B.TimeStamp) ;
Add Comment
Please, Sign In to add comment