Guest User

Untitled

a guest
May 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Hello chaps,
  2.  
  3. I have an archive tabled that is populated with new data every 15 minutes from our servers, it looks something like this.
  4.  
  5. Orgid NUMBER
  6. UserId NUMBER
  7. ArchiveDate Datetime
  8. Resources NUMBER
  9.  
  10.  
  11. MY QUESTION IS
  12.  
  13. I want to get the latest archived row each (OrgId,UserId) for each day. I've been using the below query to get the corrent org/user/archivedate, but I would like to get the corresponding Resources value to go with the row.
  14.  
  15. Is there a good way of doing this?
  16.  
  17. select orgid, userid, MAX(archivedate) as archivedate from leaguearchive
  18. group by orgid, userid
Add Comment
Please, Sign In to add comment