Guest User

Untitled

a guest
Apr 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. empid empname deptid address
  2. aa76 John 6 34567
  3. aa75 rob 4 23456
  4. aa71 smith 3 12345
  5. aa74 dave 2 12345
  6. a77 blake 2 12345
  7. aa73 andrew 3 12345
  8. aa90 sam 1 12345
  9. aa72 will 6 34567
  10. aa70 rahul 5 34567
  11.  
  12. select deptid, EMPID ,EMPNAME ,ADDRESS
  13. from mytable
  14. group by 1,2,3,4
  15.  
  16. deptid empid empname address
  17. 1 aa90 sam 12345
  18. 2 aa74 dave 12345
  19. 2 aa77 blake 12345
  20. 3 aa71 smith 12345
  21. 3 aa73 andrew 12345
  22. 4 aa75 rob 23456
  23. 5 aa70 rahul 34567
  24. 6 aa76 John 34567
  25. 6 aa72 will 34567
  26.  
  27. select distinct (deptid),EMPID,EMPNAME,ADDRESS
  28. from mytable
  29.  
  30. deptid empid empname address
  31. 1 aa90 sam 12345
  32. 2 aa74 dave 12345
  33. 2 aa77 blake 12345
  34. 3 aa71 smith 12345
  35. 3 aa73 andrew 12345
  36. 4 aa75 rob 23456
  37. 5 aa70 rahul 34567
  38. 6 aa72 will 34567
  39. 6 aa76 John 34567
Add Comment
Please, Sign In to add comment