Guest User

Untitled

a guest
Sep 16th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. Mysql GROUP BY similar fields
  2. orderid Name Email Address_1 Address_2 City* Zip*
  3. ---------------------------------------------------------------------------
  4. 1 James j@j.com 12 Foo St Fooville 1001
  5. 2 Alice a@a.com 92 Bla Road Sville 3933
  6. 3 James j@j.c0m 12 Foo Street Fooville 1001
  7. 4 james king j@j.com 12 Foo St Fooville 1001
  8. 5 Anth ann@h.com 12 Foo Street Stacker 2932
  9. 6 James j@j.com 12 American St GiftCity 0283
  10.  
  11. orderid Name Email Address_1 Address_2 City* Zip* Count
  12. ---------------------------------------------------------------------------
  13. 1 James j@j.com 12 Foo St Fooville 1001 3
  14. 2 Alice a@a.com 92 Bla Road Sville 3933 1
  15. 5 Anth ann@h.com 12 Foo Street Stacker 2932 1
  16.  
  17. GROUP BY similar((concat(name,email,address_1)
  18.  
  19. select
  20. orderid ,
  21. name ,
  22. email ,
  23. address_1 ,
  24. address_2 ,
  25. city ,
  26. zip ,
  27. count(orderid)
  28. from test
  29. group by name
  30. order by orderid
  31.  
  32. Name Email Address_1 Address_2 City Zip Count
  33. 1 James j@j.com 12 Foo St Fooville 1001 3
  34. 2 Alice a@a.com 92 Bla Road Sville 3933 1
  35. 4 James King j@j.com 12 Foo St Fooville 1001 1
  36. 5 Anth ann@h.com 12 Foo St Stacker 2932 1
Add Comment
Please, Sign In to add comment