daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT  Snapshot.xId,  MAX(Snapshot.TimeStamp) AS Timestamp_Actual,
  2.                 dateadd(dd, datediff(dd,0, MAX(Snapshot.TimeStamp)), 0) AS TimestampRange_Start,
  3.                 dateadd(MI, 1439, dateadd(dd, datediff(dd,0, MAX(Snapshot.TimeStamp)), 0)) AS TimestampRange_End
  4.                 FROM Snapshot
  5.                 GROUP BY Snapshot.xId
  6.    
  7. SELECT  Snapshot.xId,  MAX(Snapshot.TimeStamp) AS Timestamp_Actual,
  8.                 dateadd(mm, datediff(mm,0, MAX(Snapshot.TimeStamp)), 0) AS TimestampRange_Start,
  9.                 dateadd(dd, 0, dateadd(mm, datediff(mm,0, MAX(Snapshot.TimeStamp)), 0)) AS TimestampRange_End
  10.                 FROM Snapshot
  11.                 GROUP BY Snapshot.xId
  12.    
  13. SELECT Snapshot.xId, MAX(Snapshot.TimeStamp) AS Timestamp_Actual
  14.   FROM Snapshot
  15.  GROUP BY Snapshot.xId
  16. HAVING MAX(Snapshot.TimeStamp) >= dateadd(mm, datediff(mm, 0, getdate()), 0)
  17.    AND MAX(Snapshot.TimeStamp) <  dateadd(mm, 1+datediff(mm, 0, getdate()), 0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top