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 0.27 KB | None | 0 0
  1. Column1 Column2
  2. abc 100
  3. abc 200
  4.  
  5. abc 100 //here 200-100
  6.  
  7. Select
  8.  
  9. column1,
  10. sum(
  11. case when rownum=1
  12. then column2
  13. end
  14. -
  15. case when rownum=2
  16. then column2
  17. end
  18. )
  19. from table
  20. group by column1
  21.  
  22. select column1, max(column2) - min(column2)
  23. from t
  24. group by column1;
Add Comment
Please, Sign In to add comment