MySQL select only two or more rows grouped -


i have table containing 2 fields: id , username. how make select query select rows minimal 2 rows grouped?

this inside mysql table:

id| username

1 | peter
2 | jack
3 | peter
4 | ann
5 | peter
6 | jack

i want select in result this:

peter (3)
jack (2)

username 'ann' ignored in selection cause it's 1 row.

added: cannot implement situation. ok, show want do, this: (select ip ip1 ip_denylist) union (select count(user) sometotal entrances ip = ip1 , having count(sometotal) > 1) group user.

but it's not working! show how must be?

the idea of select first: select each ip address ip_denylist table, 2nd: select grouped user rows table entrances have same ip addresses.

select username, count(username) sometotal table group username having count(username) > 1 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -