Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Consider the 2 below tables
  2.  
  3. DETAILS table:-
  4. email Name Region PostalCode
  5. a@b.com Mike US-east 1234
  6. a@b.com Sara US-east 2341
  7. a@b.com Sara US-west 1234
  8. b@c.com Ash US-west 6542
  9. b@c.com Cindy US-west 4213
  10. c@d.com George US-east 1234
  11. c@d.com Thomas US-east 3412
  12.  
  13. EMAIL_STATUS table:-
  14. email status
  15. a@b.com In progress
  16. c@d.com Resolved
  17.  
  18. expected result:-
  19. email Name Region PostalCode status count(*)
  20. a@b.com Mike US-east 1234 In progress 3
  21. b@c.com Ash US-west 6542 null 2
  22. c@d.com George US-east 1234 Resolved 2
  23.  
  24. I tried various queries but none seem to work in order to get the result i expect as it leads to errors due to group by.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement