Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mysql GROUP BY similar fields
- orderid Name Email Address_1 Address_2 City* Zip*
- ---------------------------------------------------------------------------
- 1 James j@j.com 12 Foo St Fooville 1001
- 2 Alice a@a.com 92 Bla Road Sville 3933
- 3 James j@j.c0m 12 Foo Street Fooville 1001
- 4 james king j@j.com 12 Foo St Fooville 1001
- 5 Anth ann@h.com 12 Foo Street Stacker 2932
- 6 James j@j.com 12 American St GiftCity 0283
- orderid Name Email Address_1 Address_2 City* Zip* Count
- ---------------------------------------------------------------------------
- 1 James j@j.com 12 Foo St Fooville 1001 3
- 2 Alice a@a.com 92 Bla Road Sville 3933 1
- 5 Anth ann@h.com 12 Foo Street Stacker 2932 1
- GROUP BY similar((concat(name,email,address_1)
- select
- orderid ,
- name ,
- email ,
- address_1 ,
- address_2 ,
- city ,
- zip ,
- count(orderid)
- from test
- group by name
- order by orderid
- Name Email Address_1 Address_2 City Zip Count
- 1 James j@j.com 12 Foo St Fooville 1001 3
- 2 Alice a@a.com 92 Bla Road Sville 3933 1
- 4 James King j@j.com 12 Foo St Fooville 1001 1
- 5 Anth ann@h.com 12 Foo St Stacker 2932 1
Add Comment
Please, Sign In to add comment