SHARE
TWEET

Untitled

a guest Jul 17th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Input table: <br/>
  2.  
  3. UserId, CreateDate, EntityID <br/>
  4. 1 - 05.06.2000 - 1 <br/>
  5. 2 - 06.06.2000 - 1 <br/>
  6. 3 - 05.06.2000 - 2 <br/>
  7.  
  8.  
  9. Output table: <br/>
  10.  
  11. UserId, CreateDate, EntityID <br/>
  12. 2 - 06.06.2000 - 1 <br/>
  13. 3 - 05.06.2000 - 2 <br/>
  14.      
  15. select * from
  16. (select *,row_number()0ver(partition by id order by date desc) rn
  17. from table
  18. ) a where a.rn=1
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