Guest User

Untitled

a guest
Apr 25th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Hi im trying to find out how to find max of transaction_date per EAN_code
  2.  
  3. my table looks like
  4.  
  5. Transaction_Date EAN_Code
  6. 09/04/2018 3029440000286
  7. 09/04/2018 3029440000286
  8. 08/04/2018 5000128221139
  9. 14/04/2018 5000128221139
  10. 08/04/2018 5000128221139
  11. 10/04/2018 5000128221108
  12.  
  13. SELECT *
  14. FROM (SELECT *,ROW_NUMBER() OVER(PARTITION BY Ean_Code
  15. ORDER BY Transaction_Date DESC) AS rn
  16. FROM table_name) s
  17. WHERE s.rn = 1;
Add Comment
Please, Sign In to add comment